Skip to content
Source
Sign inSign up
TanStack/query

pageParams is inferred as unknown[] in the cache for infinite querys #7069

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

Describe the bug

When using infiniteQueryOptions(.....).queryKey to access the cache, the type of the pages is inferred correctly. However, the type of pageParams is just unknown[].

Your minimal, reproducible example

Ts Playground

Steps to reproduce

The ts playground has comments explaining what's going on.

Expected behavior

pageParams should be inferred as number[]

Tanstack Query adapter

None

TanStack Query version

5.25.0

TypeScript version

5.3.3

  1. Now that I think about it, maybe this is more a feature request than a bug? 😅 I mean, unknown is not wrong.. It's just odd that type inference works so well for pages but not for pageParams.

  2. TkDodo closed this

  3. TkDodo added labelsduplicate

Sign in to join this conversation.