Skip to content

Fixing incoming type errors from ts 5.1.3#130

Open
Tommy-Malone-ZOS wants to merge 3 commits intoMojang:mainfrom
Tommy-Malone-ZOS:Fixing_Incoming_Type_Errors_From_TS_5.1.3
Open

Fixing incoming type errors from ts 5.1.3#130
Tommy-Malone-ZOS wants to merge 3 commits intoMojang:mainfrom
Tommy-Malone-ZOS:Fixing_Incoming_Type_Errors_From_TS_5.1.3

Conversation

@Tommy-Malone-ZOS
Copy link
Contributor

After updating to TS 5.1.3 the behavior of type inference of array types looks to have changed. Previously the types of a useFacetMap for example would look like so: useFacetMap((a: number, b: string, c: boolean)=>{...},[...],[A: Facet<number>, B: Facet<string>, C: Facet<boolean]) After 5.1.3 the types look like so: useFacetMap((a: number | string | boolean, b: number |string | boolean, c: number | string | boolean)=>{...},[...],[A: Facet<number>, B: Facet<string>, C: Facet<boolean>]) The selector arguments are infered as the union of the types of all passed in Facets, rather than each arguments type corresponding to their Facet's inner type. This change fixes that issue by explicitly making the array type we were previously extending into a tuple type. This allows TS to correctly infer the arguments' types.

Tommy-Malone-ZOS and others added 3 commits September 18, 2023 14:07
…pes looks to have changed. Previously the types of a useFacetMap for example would look like so: After 5.1.3 the types look like so: The selector arguments are infered as the union of the types of all passed in Facets, rather than each arguments type corresponding to their Facet's inner type. This change fixes that issue by explicitly making the array type we were previously extending into a tuple type. This allows TS to correctly infer the arguments' types.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant