Skip to content

Inference is not working properlyΒ #63348

@eduardocque

Description

@eduardocque

πŸ”Ž Search Terms

inference
performance

⏯ Playground Link

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions