I'm currently using a Guard with a canActivate
method:
canActivate(
next: ActivatedRouteSnapshot,
state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
return this.fireAuth.authState.pipe(
take(1),
map(authState => !!authState),
map(auth => !auth ? this.router.navigate(['/']) : true)
)
}
The functionality works fine, but I am encountering a typescript error in the console:
ERROR in auth.guard.ts(20,7): error TS2322: Type 'Observable>' is not assignable to type 'boolean | UrlTree | Observable | Promise'.
Can anyone suggest a solution for resolving this error?