Skip to content

infiniteQueryOptions can't be used with both useInfiniteQuery and useSuspenseInfiniteQuery #8184

@alisamonstr

Description

@alisamonstr

Describe the bug

When upgrading from 5.59.9 to 5.59.14 the types from basic infiniteQueryOptions changed so they don't work with both useInfiniteQuery and useSuspenseInfiniteQuery when you set

 "compilerOptions": {
    "strict": true,
    "exactOptionalPropertyTypes": true
  }

Your minimal, reproducible example

https://stackblitz.com/edit/vitejs-vite-xfkpkc?file=src%2FApp.tsx

Steps to reproduce

  1. Go to App.tsx
  2. Observe Type error on line 41 (infiniteQueryResult)
  3. Downgrade to "@tanstack/react-query": "5.59.9"
  4. Go back to App.tsx and observe that the Type error is gone

Expected behavior

Not having a Type error

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

  • Typescript "5.6.2"

Tanstack Query adapter

react-query

TanStack Query version

5.59.14

TypeScript version

5.6.2

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions