我有一個Typescript編譯的問題。此代碼返回錯誤:Typescript instanceof - 找不到名字
error TS2304: Cannot find name 'NavigationEnd'.
如何讓編譯器瞭解NavigationEnd類型? NavigationEnd是angular2路由器事件類型。
this.router.events.subscribe((e) => {e instanceof NavigationEnd ?
console.log('NavigationEnd'):console.log('Not NavigationEnd')});
我使用IDE PHPStorm。
你是從'@ angular/router'導入它的嗎? –
@GünterZöchbauer謝謝你。 – norweny