`pageParam` never seems to get inferred correctly from initialPageParam
requestData.search.continuation is typed as string | undefined but pageParam is unknown5 Replies
sunny-green•11mo ago
Try using https://tanstack.com/query/latest/docs/framework/react/reference/infiniteQueryOptions instead of the generic, you should get easier and more accurate type inference
infiniteQueryOptions | TanStack Query React Docs
tsx infiniteQueryOptions({ queryKey, ...options, }) Options You can generally pass everything to infiniteQueryOptions that you can also pass to . Some options will have no effect when then forwarded t...
ratty-blushOP•11mo ago
Tried that already -
pageParam is still unknownsunny-green•11mo ago
Perhaps provide a default
initalPageParam so the type is always string
initialPageParam is required; unrefined will not be acceptedratty-blushOP•11mo ago
Well my cursor is a continuation token - therefore the first page is technically no continuation token so the type would be string | undefined
rising-crimson•11mo ago
Show a typescript playground please