-
Notifications
You must be signed in to change notification settings - Fork 748
Open
Labels
Type OrderingAn issue related to ordering of typesAn issue related to ordering of types
Description
Steps to reproduce
I'm making every effort to make this a "minimal reproduction" but I'm still not happy with it. Sharing it nonetheless with the hope to update the playground with even simpler code.
Behavior with typescript@5.8
No errors
Behavior with tsgo
src/file.tsx:33:41 - error TS2345: Argument of type '{ formData: BaseDocument; }' is not assignable to parameter of type '{ formData: Message; }'.
Types of property 'formData' are incompatible.
Type 'BaseDocument' is not assignable to type 'Message'.
Property 'subject' is missing in type 'BaseDocument' but required in type '{ subject: string; }'.
33 return <Form fields={(args) => fields(args)} itemsState={messagesState} />;
~~~~
src/file.tsx:11:3 - 'subject' is declared here.
11 subject: string;
~~~~~~~
src/file.tsx:33:48 - error TS2322: Type 'WritableAtom<Message[], [SetStateAction<Message[]>], void> & WithInitialValue<Message[]>' is not assignable to type 'ItemState<BaseDocument> | ItemsState<BaseDocument>'.
Type 'WritableAtom<Message[], [SetStateAction<Message[]>], void> & WithInitialValue<Message[]>' is not assignable to type 'ItemsState<BaseDocument>'.
Types of property 'write' are incompatible.
Type 'Write<[SetStateAction<Message[]>], void>' is not assignable to type 'Write<[SetStateAction<BaseDocument[]>], void>'.
Types of parameters 'args' and 'args' are incompatible.
Type 'SetStateAction<BaseDocument[]>' is not assignable to type 'SetStateAction<Message[]>'.
Type 'BaseDocument[]' is not assignable to type 'SetStateAction<Message[]>'.
Type 'BaseDocument[]' is not assignable to type 'Message[]'.
Type 'BaseDocument' is not assignable to type 'Message'.
Property 'subject' is missing in type 'BaseDocument' but required in type '{ subject: string; }'.
33 return <Form fields={(args) => fields(args)} itemsState={messagesState} />;
~~~~~~~~~~
src/file.tsx:11:3 - 'subject' is declared here.
11 subject: string;
~~~~~~~
src/file.tsx:21:3 - The expected type comes from property 'itemsState' which is declared here on type 'IntrinsicAttributes & FormProps<BaseDocument>'
21 itemsState: ItemsState<T> | ItemState<T>;
~~~~~~~~~~
Metadata
Metadata
Assignees
Labels
Type OrderingAn issue related to ordering of typesAn issue related to ordering of types