这是indexloc提供的服务,不要输入任何密码
Skip to content

useQueries not inferring type correctly, when using onSuccess and select #3994

@plotka

Description

@plotka

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions