query icon indicating copy to clipboard operation
query copied to clipboard

useQueries not inferring type correctly, when using onSuccess and select

Open plotka opened this issue 2 years ago • 0 comments

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

  1. Go to sandbox - https://codesandbox.io/s/wizardly-ride-w58pio?file=/src/App.tsx
  2. Check onSuccess in useQuery() options, it works fine.
  3. Check onSuccess and select in useQueries() 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

image

Platform

  • OS: mac OS
  • Browser: Opera

react-query version

v4.0.10

TypeScript version

v4.7.4

Additional context

No response

plotka avatar Aug 08 '22 14:08 plotka