-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typescript React Query v5 wrong type infinite query #541
Comments
Hi @groomain, can you give more details about the expected return?
I'm confused by the double layer of
What's the |
types on this level look correct to me:
because they are forwarded to
and in react-query, our defaults are similar:
so |
Which packages are impacted by your issue?
No response
Describe the bug
Hi,
I also have an issue with infinite query. I tried upgrading to the last version.
I think this type is wrong
export function useInfiniteQuery<
TQueryFnData,
TError = DefaultError,
TData = InfiniteData,
TQueryKey extends QueryKey = QueryKey,
TPageParam = unknown,
Is it the good type for TData @TkDodo @neil585456525 ?
The TData = InfiniteData, should it be only TQueryFnData ?
because with the version 6.0.0 all my infinite queries types in typescript does not match what is really returned.
I have a strange typescript error on what I should have on my result data. I should have an array
{
pageParams : ... [],
pages: {
pageParams : unknown[],
pages: result[]
}[]
}
but what I really have is not an array
{
pageParams : ...,
pages: result[]
}
This type is used for the result and it already use InfiniteData. So I thinks it should not be in the useInfiniteQuery type params
export interface InfiniteQueryObserverSuccessResult<
TData = unknown,
TError = unknown,
Thanks for your help!
Your Example Website or App
https://codesandbox.io/p/devbox/wild-water-xrq5tp?file=%2Ftypes.ts%3A90%2C5
Steps to Reproduce the Bug or Issue
Go to types find useInfiniteUserQuery
Types is
The text was updated successfully, but these errors were encountered: