In Angular 11 this works:
this.r.events.pipe(
filter(event => event instanceof NavigationEnd),
map((event: NavigationEnd) => event.url == ROUTES.APPLICATION))
However in Angular 12 it produces the error:
Argument of type 'MonoTypeOperatorFunction<Event_2>' is not assignable to parameter of type 'OperatorFunction<Event_2, NavigationEnd>'.
Type 'Observable<Event_2>' is not assignable to type 'Observable'.
Type 'Event_2' is not assignable to type 'NavigationEnd'.
Property 'urlAfterRedirects' is missing in type 'RouterEvent' but required in type 'NavigationEnd'.ts(2345)
Any ideas on how to fix this?
This question has the answer as adding:
"paths": {
"rxjs": [
"node_modules/rxjs"
],
"rxjs/*": [
"node_modules/rxjs/*"
]
}
To tsconfig.json. However that did not work ...