angular - Property 'currentUser' does not exist on type 'FirebaseAuthState' -


trying currentuser in angularfire2. type exposes this?

https://firebase.google.com/docs/reference/js/firebase.auth.auth

it's not obvious me exploring observable:

constructor(private auth: firebaseauth) {   auth.subscribe((user) => console.log('user is', user));     } 

the user object receive firebaseauth observable contains following properties:

  • provider
  • uid
  • auth

the last of these - auth - currentuser. if @ source, can see auth property firebase user.

you can verify using instanceof:

constructor(private auth: firebaseauth) {     auth.subscribe(         (user) => {             if (user) {                 console.log('user.auth user instance = ' + (currentuser instanceof firebase.user));                 let currentuser = user.auth;                 // ...             } else {                 console.log('no user signed in');             }         }     ); } 

Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -