Having trouble setting up Google SignIn with Firestorm. The guide I used is outdated and doesn't provide the information I need.
The main issue is:
export class AuthService {
user$: Observable<User>; //This Observable can be NULL or undefined.
constructor(
private afAuth: AngularFireAuth,
private afs: AngularFirestore,
private router: Router
) {
this.user$ = this.afAuth.authState.pipe( //this one is not assignable to null or undefined
switchMap(user => {
// Logged in
if (user) {
return this.afs.doc<User>(`users/${user.uid}`).valueChanges();
} else {
// Logged out
return of(null);
}
})
)
}
}
Encountering this error consistently:
Type 'Observable<User | null | undefined>' is not assignable to type 'Observable'. Type 'User | null | undefined' is not assignable to type 'User'. Type 'undefined' is not assignable to type 'User'.ts(2322)
Struggling to find a solution.
Referenced documentation that led me here: