You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, when using TypeScript's isolated declarations (isolatedDeclarations), all module exports must have type annotations. For this reason it would be preferable to use a type annotation rather than the infiniteQueryOptions type constructor.
The problem with this, however, is it's very verbose:
Except for the first and last type parameters provided to UnusedSkipTokenInfiniteOptions, all the others could theoretically just use the defaults. However, we're forced to provide them because we need to provide TPageParam (the last type parameter), otherwise it would default to unknown.
Given more TypeScript users will likely be looking to enable isolated declarations in the future and thus be required to add type annotations, I wonder if we could make these types more ergonomic.
One idea would be to move the position of the TPageParam type parameter in the *InfiniteOptions types, so we can benefit from defaults. For example, if it was moved from last to second position then the example above would look much better:
Describe the bug
The docs suggest using
infiniteQueryOptions
to abstract infinite query options. For example:However, when using TypeScript's isolated declarations (
isolatedDeclarations
), all module exports must have type annotations. For this reason it would be preferable to use a type annotation rather than theinfiniteQueryOptions
type constructor.The problem with this, however, is it's very verbose:
Except for the first and last type parameters provided to
UnusedSkipTokenInfiniteOptions
, all the others could theoretically just use the defaults. However, we're forced to provide them because we need to provideTPageParam
(the last type parameter), otherwise it would default tounknown
.Given more TypeScript users will likely be looking to enable isolated declarations in the future and thus be required to add type annotations, I wonder if we could make these types more ergonomic.
One idea would be to move the position of the
TPageParam
type parameter in the*InfiniteOptions
types, so we can benefit from defaults. For example, if it was moved from last to second position then the example above would look much better:Your minimal, reproducible example
N/A
Steps to reproduce
N/A
Expected behavior
N/A
How often does this bug happen?
None
Screenshots or Videos
No response
Platform
N/A
Tanstack Query adapter
None
TanStack Query version
N/A
TypeScript version
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: