0
我有下面的代碼:問題與路由器事件
this.routerSubscription = this._router.events
.filter(event => event instanceof NavigationStart)
.subscribe((event:Event) => {
....
});
會拋出我的錯誤:我在做什麼錯
error TS2345: Argument of type '(event: Event) => void' is not assignable to parameter of type 'NextObserver<NavigationStart | NavigationEnd | NavigationCancel | NavigationError> | ErrorObserve...'.
Type '(event: Event) => void' is not assignable to type '(value: NavigationStart | NavigationEnd | NavigationCancel | NavigationError) => void'.
Types of parameters 'event' and 'value' are incompatible.
Type 'NavigationStart | NavigationEnd | NavigationCancel | NavigationError' is not assignable to type 'Event'.
Type 'NavigationStart' is not assignable to type 'Event'.
Property 'bubbles' is missing in type 'NavigationStart'.
?