section, I encountered issues with my Angular project after upgrading from ng15 to ng16. Specifically, errors are arising when trying to implement the code snippet below. Can anyone provide insights on what may be causing problems with the event argument in this particular construction?
if (this.menuOpenSubscription === undefined) {
this.menuOpenSubscription = this.router.events.subscribe(
(event: RouterEvent) => this.handleNavigationEnd(event)); // Error in ng16
}
Upon compilation, the following errors were reported:
> Overload 1 of 2, '(observerOrNext?: Partial<Observer<Event_2>> |
> ((value: Event_2) => void)): Subscription', gave the following error.
> [1] Argument of type '(event: RouterEvent) => void' is not
> assignable to parameter of type 'Partial<Observer<Event_2>> | ((value:
> Event_2) => void)'. [1] Type '(event: RouterEvent) => void' is
> not assignable to type '(value: Event_2) => void'. [1] Types
> of parameters 'event' and 'value' are incompatible. [1] Type
> 'Event_2' is not assignable to type 'RouterEvent'. [1]
> Type 'ActivationEnd' is missing the following properties from type
> 'RouterEvent': id, url [1] Overload 2 of 2, '(next?: (value:
> Event_2) => void, error?: (error: any) => void, complete?: () =>
> void): Subscription', gave the following error. [1] Argument of
> type '(event: RouterEvent) => void' is not assignable to parameter of
> type '(value: Event_2) => void'. [1] Types of parameters 'event'
> and 'value' are incompatible. [1] Type 'Event_2' is not
> assignable to type 'RouterEvent'.