Skip to content

Type checking select works differently on useQueries compared to useQuery #6556

Description

@jtannas

Describe the bug

When using useQuery, TS correctly infers the argument type of the select query option to be the return type of the queryFn data.
Applying the same settings to useQueries it loses that link and changes it to any.
The linked TS sandbox shows the issue better than I can explain it though.

Your minimal, reproducible example

https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAbzgVwM4FMCKz1WO1AGhQ21wE84BfOAMyghDgCIABGAQwDtVOBjANYB6KOg58YAWgCOOKOWYAoRXwg94IcgBEOnOAF44AbQCMxAEzEAzMQAsxAKzEAbAF1lKtbziay8gyRYcuQAFAiKcHCyFADS6OQAXMYA5OgAbuhcya6EEVHBAGJcSSEAlAYAfHAACgwgwBgAdKKoEAA2GSGaOpyluZEYbegSJRxQUOX6VWNQjbTAbTC4IcCVcKsApHDmBvqGAAx9ilSlyqrqPuR++KgBaEG4N2HReARJRnnhkZEv5HGJKXSmWy-W+vyKJUmVVqjAa6GaBHanW6ug4R2+cEGwxgo3GULgMzmCyWUBWa02212B3R1FyrhOiiAA

Steps to reproduce

See linked Typescript playground to a minimal reproducible example

Expected behavior

I would like the type checking of select on useQueries to work as well as it does on useQuery.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

  • Ubuntu 22.04

Tanstack Query adapter

react-query

TanStack Query version

v5.3.2

TypeScript version

v5.14.0

Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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