When using Angular 11, the following code snippet functions correctly:
this.r.events.pipe(
filter(event => event instanceof NavigationEnd),
map((event: NavigationEnd) => event.url == ROUTES.APPLICATION))
However, when migrating to Angular 12, it results in the following 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)
Do you have any suggestions on how to resolve this issue?
This question provides a solution by adding the following to tsconfig.json
:
"paths": {
"rxjs": [
"node_modules/rxjs"
],
"rxjs/*": [
"node_modules/rxjs/*"
]
}
However, this did not resolve the issue...