Skip to content

TypeScript: Not possible to pass the type of the QueryKey to useQuery(react-query v3.3.0) #1462

@jon301

Description

@jon301

Describe the bug
Current typings of useQuery (also prefetchQuery and fetchQuery) support string-only query keys.
It seems not possible to pass a custom type (for array keys).

To Reproduce
https://codesandbox.io/s/objective-nobel-8incc?file=/src/App.tsx

Expected behavior
It should be possible to pass a generic type for query keys.

Desktop

  • Version: 3.3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions