-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Inference is not working properlyΒ #63348
Copy link
Copy link
Open
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug
Description
π Search Terms
inference
performance
β― Playground Link
π Actual behavior
im testing some hard inference, and seems to be that typescript is not able to infer properly the generic type from the function parameter, so i have to specify it to make it able to works
for example
const [schema3, setSchema3] = useStoreByPath<{ schema: { subValue: number }; style: string }, 'schema.subValue'>('schema.subValue');
π Expected behavior
if i specify the first argument of my function, this should automatically infer it
for example
const [schema3, setSchema3] = useStoreByPath<{ schema: { subValue: number }; style: string }>('schema.subValue');
i have attached a link where can be reproduced
Additional information about the issue
seems to be that the issue is when the first generic type is specified and we expect that the second argument will be inferred from the function parameters
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug