Code:
Using map and switchMap from 'rxjs/operators'.
import { map, switchMap } from 'rxjs/operators';
Here is the canActivate code for route guard:
canActivate(): Observable<boolean> {
return this.auth.userObservable
.pipe(switchMap((user: firebase.User) => this.userService.fetch(user.uid))
.map((user) => user.isSeller));
}
An error is encountered with message: Property 'map' does not exist on type 'OperatorFunction'. Screenshots provided below.
https://i.sstatic.net/o0siw.png
https://i.sstatic.net/uQVnZ.png
Attempt made: Attempting to wrap map within pipe but still facing issues.
canActivate(): Observable<boolean> {
return this.auth.userObservable
.pipe(switchMap((user: firebase.User) => this.userService.fetch(user.uid))
.pipe(map((user) => user.isSeller)));
}
The above syntax is throwing errors as well. Any insights on what may be causing this issue would be greatly appreciated. Thanks in advance!