orval is able to generate client with appropriate type-signatures (TypeScript) from any valid OpenAPI v3 or Swagger v2 specification, either in yaml or json formats. 🍺
Generate a TanStack-Query client (react for example).
Call a generated hook (useListPets() for example).
Call queryClient.getQueryData / queryClient.setQueryData with the queryKey returned from the hook call.
What happens?
The return-type of queryClient.getQueryData is 'unknown'
(added the lines of code to the basic react query sample)
What were you expecting to happen?
It's a missing feature, not a bug. I would love for it to be:
The return-type of queryClient.getQueryData is 'PetsArray | undefined'.
Basically, I would like to match the behavior of the type-helper function 'queryOptions()' introduced in TanStack Query v5, specifically it's DataTag mechanism.
What are the steps to reproduce this issue?
What happens?
The return-type of queryClient.getQueryData is 'unknown'
(added the lines of code to the basic react query sample)
What were you expecting to happen?
It's a missing feature, not a bug. I would love for it to be: The return-type of queryClient.getQueryData is 'PetsArray | undefined'.
Basically, I would like to match the behavior of the type-helper function 'queryOptions()' introduced in TanStack Query v5, specifically it's DataTag mechanism.
TanStack Query maintainer TkDodo explains all about it here: https://tkdodo.eu/blog/the-query-options-api#datatag
Any logs, error output, etc?
N/A - feature
Any other comments?
This would also help with queryClient.setQueryData type-safety, and type-safety of any future function consumer of TaggedQueryKey in TanStack Query.
What versions are you using?
System: OS: Windows 11 10.0.22631 CPU: (16) x64 12th Gen Intel(R) Core(TM) i7-1260P Memory: 4.66 GB / 15.73 GB npmPackages: @tanstack/react-query: ^5.0.0 => 5.39.0 msw: ^2.0.2 => 2.3.0 react: ^17.0.1 => 17.0.2