-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Type-narrowing doesn't work #3055
Comments
I don't think |
@Ram4GB My bad. Fixed the example! |
I assume you request the user who is not found in your database or has been deleted by other actions. In this case, the API must throw the error with the status |
Not sure to understand. I'm just saying if "isLoading" is false, then "data" should become of type "number". It is a basic functionality of TanStack query: https://tanstack.com/query/latest/docs/framework/react/typescript#type-narrowing |
But if fetching fails/errors, there won't be data, and it won't be loading either. |
@icyJoseph Updated my example. Makes sense? Basically I'm asking for the same thing than TanStack Query. |
Yes @lcswillems, your example is not clear to me. In your case, I believe we should get the type |
Yes we should get the type |
Bug report
Description / Observed Behavior
Expected Behavior
It should be of type
number
.The text was updated successfully, but these errors were encountered: