-
Notifications
You must be signed in to change notification settings - Fork 186
Closed
Description
I am having issues with $push and ReadonlyArray types, which is very common in graphql codegen generated interfaces.
Minimal Example
interface Thing {
bar: {
foo: ReadonlyArray<{ baz: number }>;
};
}
declare const a: Thing;
declare const b: Thing;
update(a, { bar: { foo: { $push: b.bar.foo } } });
returns this type error:
Type 'readonly { baz: number; }[]' is not assignable to type 'Spec<{ baz: number; }, never>'.
Type 'readonly { baz: number; }[]' is not assignable to type '(v: { baz: number; }) => { baz: number; }'.
Type 'readonly { baz: number; }[]' provides no match for the signature '(v: { baz: number; }): { baz: number; }'.ts(2322)
Workaround
Use $set instead
Metadata
Metadata
Assignees
Labels
No labels