Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing incoming type errors from ts 5.1.3 #130

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

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