-
Notifications
You must be signed in to change notification settings - Fork 306
Closed
Description
It looks like the loading utility hook types the value
property as void
. This makes it difficult to work around potential edge cases in the code:
let [ user, userIsLoading, userError ] = useAuthState(firebase.auth());
if (userIsLoading) {
return null;
}
// do something with user ...
user.someProperty; // <- errors with "someProperty doesn't exist on type void | User"
The problem here is that, because user
is typed as possibly being void
(which is different from undefined
), I can't even do something like user!.someProperty
to assure TS that the variable will have a value.
I think the fix here is to switch to undefined
as the fallback type.
L4B0MB4, nhagen and tizzle
Metadata
Metadata
Assignees
Labels
No labels