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

v3 - improve type narrowing for query response data #785

Merged
merged 1 commit into from
Oct 16, 2024

Conversation

mathiazom
Copy link
Contributor

Checking response.data !== null was not enough to narrow the type of response from QueryResponseInitial<T | null> to just QueryResponseInitial<T>, so a custom type guard has been defined

Copy link

vercel bot commented Oct 16, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
variant-no ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 16, 2024 10:49am
variant-se-2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 16, 2024 10:49am

checking `response.data !== null` was not enough to narrow the type of `response` from `QueryResponseInitial<T | null>` to just `QueryResponseInitial<T>`, so a custom type guard has been defined
@mathiazom mathiazom merged commit b607e45 into v3 Oct 16, 2024
6 checks passed
@mathiazom mathiazom deleted the refactor/v3-query-response-type-narrowing branch October 16, 2024 10:52
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