Skip to content
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

useSuspenseQuery must not contain undefined type for data #181

Open
kbumsik opened this issue Mar 28, 2025 · 0 comments
Open

useSuspenseQuery must not contain undefined type for data #181

kbumsik opened this issue Mar 28, 2025 · 0 comments

Comments

@kbumsik
Copy link

kbumsik commented Mar 28, 2025

Describe the bug

Generated type of useSuspenseQuery's data (TData) must not contain undefined unlike useQuery.

This is the point of using useSuspenseQuery. TanStack Query document clearly states that

const { data } = useSuspenseQuery({ queryKey, queryFn })
This works nicely in TypeScript, because data is guaranteed to be defined (as errors and loading states are handled by Suspense- and ErrorBoundaries).

To Reproduce

Generate anything with 2.0.0-beta.3

Expected behavior

Generated suspend queries's data must be non-nullable.

Maybe just add NonNullable<> around TData?

@kbumsik kbumsik changed the title useSuspenseQuery must not have undefined type for data useSuspenseQuery must not contain undefined type for data Mar 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant