Hello, I am in the process of determining the user's availability status within the component. My goal is to return true
if the user is logged in, otherwise return false.
I am utilizing Firebase's method to monitor the user's login state:
firebase.auth().onAuthStateChanged
Below is the snippet of code I have written for this task:
const isLoggedIn = firebase.auth().onAuthStateChanged(user => {
console.log(!!user)
return !!user;
});
const showSaveTheProgressButton:boolean = isLoggedIn;
However, when attempting to return a boolean value from this function, something unexpected is being returned instead of a boolean:
Type 'false | Unsubscribe' is not assignable to type 'boolean'.
The program is throwing an error message indicating that it is receiving something other than a boolean, specifically 'Unsubscribe.'
This leads me to believe that the program should not be returning 'Unsubscribe,' right?