angular-firestarter icon indicating copy to clipboard operation
angular-firestarter copied to clipboard

error TS2339: Property 'uid' does not exist on type '{}

Open aashish-ak opened this issue 7 years ago • 2 comments

switchMap(user => {
        if (user) {
          return this.afs.doc<User>(`users/${user.uid}`).valueChanges();
        } else {
          return of(null);
        }
      })

This function in the auth.service.ts constructor, is giving the following error during compilation:

error TS2339: Property 'uid' does not exist on type '{}

aashish-ak avatar Jun 30 '18 16:06 aashish-ak

i'm getting that, too.

jorluiseptor avatar Jul 18 '18 21:07 jorluiseptor

It sounds like TS is not getting the right type. Does this fix it at line 33?

switchMap((user as any) => ...)

We might need to explicitly type this to the Firebase SDK user type

codediodeio avatar Jul 18 '18 21:07 codediodeio