Skip to content

V2: Add overload to make sure createQueryOptions only returns skipToken when could be passed skipToken #469

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

Merged
merged 1 commit into from
Oct 28, 2024

Conversation

paul-sachs
Copy link
Collaborator

@paul-sachs paul-sachs commented Oct 25, 2024

In order to use createQueryOptions with recent versions of react-query and useSuspenseQuery, we need to make sure createQueryOptions isn't passing skipToken as a potential type when the input type couldn't be skipToken. This is because the typings for useSuspenseQuery now disallow skipping (which was always the case, just was not reflected in the types.)

To fix this, we overload the createQueryOptions call to indicate with it's types that it will only return a skipToken when input is a skipToken.

…hen could be passed skipToken

Signed-off-by: Paul Sachs <psachs@buf.build>
@paul-sachs paul-sachs changed the title Add overload to make sure createQueryOptions only returns skipToken when could be passed skipToken V2: Add overload to make sure createQueryOptions only returns skipToken when could be passed skipToken Oct 25, 2024
@paul-sachs paul-sachs merged commit 4f29429 into v2 Oct 28, 2024
12 checks passed
@paul-sachs paul-sachs deleted the psachs/create-options-suspense branch October 28, 2024 16:24
@timostamm timostamm mentioned this pull request Nov 1, 2024
@timostamm timostamm mentioned this pull request Nov 5, 2024
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

Successfully merging this pull request may close these issues.

2 participants