TS2339: Property 'debounceTime' does not exist on type 'Observable '. - Angular 6


 【出現的問題】TS2339: Property 'debounceTime' does not exist on type 'Observable<any>'.

 


 

【解決方法】

第一步,在 Terminal 更新 Angular

ng update

第二步,fix the rxjs

npm i -g rxjs-tslint

第三步,修改代碼,不再使用debounceTime(500),而是在外邊添加 .pipe(),即變成.pipe(debounceTime(500))

this.titleFilter.valueChanges
      .pipe(debounceTime(500))
      .subscribe( 
        value => this.keyword
      );

 


 

參考

https://stackoverflow.com/questions/49811177/angular-6-rxjs-import-syntax#answer-50342338

https://github.com/ReactiveX/rxjs/issues/3723#issuecomment-390855559


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM