Describe the bug#
Due to this line pageParams on infinite queries have a type of unknown.
https://github.com/TanStack/query/blob/603a346d4f5ffaf02f49bf32ac5221029da6f4a1/packages/svelte-query/src/createInfiniteQuery.ts#L19
InfiniteData receives a second generic parameter for a key type but since TPageParam parameter appears later you can't provide it there.
This is just an FIY, it's not a priority issue and it doesn't bother me but I thought you would wanna know.
Your minimal, reproducible example#
.
Steps to reproduce#
const iq = createInfiniteQuery({
queryKey: [],
queryFn() {
return 1;
},
getNextPageParam() {
return 1;
},
initialPageParam: 0
});
$iq.data?.pageParams;
Expected behavior#
.
How often does this bug happen?#
Every time
Screenshots or Videos#
No response
Platform#
.
Tanstack Query adapter#
svelte-query
TanStack Query version#
5.6.1
TypeScript version#
5.2.2
Additional context#
No response
we're aware of this - it's not svelte specific though. Adding the additional type parameter would mean that
createInfiniteQueryand all hooks in react likeuseInfiniteQuerywould need another type parameter. It's doable but the benefit is minor - it's very unlikely that you need access topageParamsduring rendering. They are kind of an internal thing that we store alongside data and pass it togetNextPageParam.I would say for now, this is a known limitation that we won't address unless there's a real need / use-case for it.