query
query copied to clipboard
useQueries not inferring type correctly, when using onSuccess and select
Describe the bug
When using useQueries()
with typed individual queries, the data type is not inferred when using onSuccess
or select
methods, and we get an error
Parameter 'data' implicitly has an 'any' type.
With useQuery()
it works fine and we can see the data
's type:
(parameter) data: number
Your minimal, reproducible example
https://codesandbox.io/s/wizardly-ride-w58pio?file=/src/App.tsx
Steps to reproduce
- Go to sandbox - https://codesandbox.io/s/wizardly-ride-w58pio?file=/src/App.tsx
- Check
onSuccess
inuseQuery()
options, it works fine. - Check
onSuccess
andselect
inuseQueries()
options, it has an error.
Expected behavior
It is expected to have the inferred type also in useQueries()
How often does this bug happen?
No response
Screenshots or Videos
Platform
- OS: mac OS
- Browser: Opera
react-query version
v4.0.10
TypeScript version
v4.7.4
Additional context
No response