Type ‘Observable<User | null | undefined>’ is not assignable to type ‘Observable<User>’

Im trying to create a Google SignIn with Firestorm. But to many things have chanced since the creation of the guide and i cant find an answer 🙁

So the Problem 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);
        }
      })
    )
    
   }
}

Im always getting this error:

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)

But i cant figure out what to to.

Thats the original documetation:

https://fireship.io/lessons/angularfire-google-oauth/

Source: Angular Questions