make onSucces be a TS typeguard #5339
Unanswered
marekvanicek
asked this question in
Ideas
Replies: 1 comment 6 replies
-
I mean ... that's really not what's happening. I can easily prove this (typescript playground), but it's tiring that you haven't done this yourself ... |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
So,
data
from useQuery is thetype | undefined
. I get that, but should not the data be always present if checked in onSuccess?For example
My take on this is that isSuccess should be a type guard. Or introduce a new function that is a typeguard. Making the type in inside the isSucces if statement a User[].
Beta Was this translation helpful? Give feedback.
All reactions