In Angular 11 this works:
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<NavigationEnd>'.
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:
tsconfig.json. However that did not work …
Source: Angular Questions