Skip to content
Source
Sign inSign up
TanStack/query

TypeScript v5 Support #5698

Send to my agent
Closedenchorb(GitHub profile, opens in a new tab) opened this issue 2 comments

Describe the bug

I'm using v5 of this library and it does not work at all with TypeScript v5, ie:

is not assignable to parameter type UseInfiniteQueryOptions<unknown, DefaultError, InfiniteData<unknown>, unknown, QueryKey, unknown> is not assignable to parameter type UseMutationOptions<unknown, DefaultError, void, unknown>

Reverting back to TypeScript v4 4.9.5 to be exact works fine again.

Your minimal, reproducible example

N/A

Steps to reproduce

Use TypeScript v5 with this library

Expected behavior

Types should work

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

Any platform

Tanstack Query adapter

None

TanStack Query version

5.0.0-alpha.71

TypeScript version

5.1.6

Additional context

No response

  1. please show a typescript playground reproduction that shows the problem you're having. A simple useInfiniteQuery works fine on my side:

    https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAbzgVwM4FMCSA7AZsbYGdARWXSgE84BfOXKCEOAcgAEYBDbVLgYwDWAeijpOfGAFoAjuSos4QoXBiUw6VAC44nADZgAFpwBQoSLDgAqHajh9o6eo2bsuPfsNkVKk+6IVKKmoa2nqGJsZoWHgERKRylAAUCMZwaXBeVADS6JTaANos6AAenOC66CwAugA0qemZlABi2NrJcGCcAOboAAqcUGW0AJRwALwAfHC9zsAYAHSiqBC6AG7oiUWl5ZVwANQd3X0DZcN16XAAJui4nMi6MP09-YMg2gCM5+k9MAByJY8ji8ym0APq6Ti8J7oGpwUF6XTQ1CwiFQoEnECjSZwVGA54Y-Zwd7GGjDIA

    note that the import * as core is only necessary to make the typescript playground pull in the query-core types of alpha as well, it is not necessary in a real app or in a codesandbox environment.

  2. TkDodo added labelstypes

  3. TkDodo added labelsneeds-info

  4. TkDodo added labelsv5

  5. feel free to reopen with a reproduction

  6. TkDodo closed this

Sign in to join this conversation.