Skip to content

Regression between 5.100.12 and 5.100.13 (useQuery's data being inferred as any) #11244

Description

@Alexis-D

Describe the bug

react-query 5.100.13 includes a single change, an update to query-core 5.100.13. Which in turn includes a single change. Which links to #9937, #10593.

I believe this introduces a regression as shown in https://github.com/Alexis-D/useQuery.

This code in 5.100.12:

https://github.com/Alexis-D/useQuery/blob/fd14f0eb61cb851dbb12cea99afcb9dd88ab44f0/with-5.100.12/src/App.tsx#L8-L13

Correctly infers data as Foo:

Image

But the same code with 5.100.13:

https://github.com/Alexis-D/useQuery/blob/fd14f0eb61cb851dbb12cea99afcb9dd88ab44f0/with-5.100.13/src/App.tsx#L8-L13

Infers data as any:

Image

Which looks like a regression?

Your minimal, reproducible example

https://github.com/Alexis-D/useQuery/tree/master

Steps to reproduce

  1. git clone git@github.com:Alexis-D/useQuery.git
  2. cd useQuery
  3. (cd with-5.100.12 && npm i) && (cd with-5.100.13 && npm i)
  4. Open with-5.100.12 and with-5.100.12 in your editor of choice, compare the infered types of data in src/App.tsx.

Expected behavior

data should be infered as Foo in both versions.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

macOS, though I'm guessing that's unrelated.

Tanstack Query adapter

react-query

TanStack Query version

v5.100.13

TypeScript version

v6.0..3

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions