I am encountering an error that reads:
error TS2322: Type 'Observable<void | AuthError>' is not assignable to type 'Observable<Action>'. Type 'void | AuthError' is not assignable to type 'Action'. Type 'void' is not assignable to type 'Action'.
Can someone explain what this error means and how I can resolve it?
googleSignIn: Observable<Action> = this.actions.pipe(
ofType(authActions.GOOGLE_SIGNIN),
map((action: authActions.GoogleSignIn) => action.payload),
switchMap(() => {
return Observable.fromPromise(this.authService.googleSignIn());
}),
catchError(err => {
return Observable.of(new authActions.AuthError({ error: err.message }));
})
);
authService.googleSignIn()
googleSignIn() {
this.logger.debug('Initialising desktop Google sign in');
const provider = new auth.GoogleAuthProvider();
let firstName = null;
let lastName = null;
return this.afAuth.auth.signInWithPopup(provider).then(async (result) => {
if (result) {
firstName = result.additionalUserInfo.profile['given_name'];
lastName = result.additionalUserInfo.profile['family_name'];
const path = `/users/${result.user.uid}/`;
const doc = await this.firebaseService.docExists(path);
if (!doc) {
this.userService.processNewUser(result, firstName, lastName);
}
if (doc) {
this.logger.debug(`${firstName} ${lastName} is a returning desktop user`);
}
}
}).catch((error) => {
this.simpleModalService.displayMessage('Oops', error.message);
});
}