700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > 响应式编程时出现:error TS2339: Property 'debounceTime' does not exist on type 'Observableany'.

响应式编程时出现:error TS2339: Property 'debounceTime' does not exist on type 'Observableany'.

时间:2023-08-24 22:06:29

相关推荐

响应式编程时出现:error TS2339: Property 'debounceTime' does not exist on type 'Observableany'.

constructor() {this.searchInput.valueChanges//.debounceTime(500) 无法使用.pipe(debounceTime(1000)).subscribe( stockCode => this.getStockInfo(stockCode)) ;.....省略}

运行这段代码时提示:ERROR in src/app/bind/ponent.ts(25,8): error TS2339: Property ‘debounceTime’ does not exist on type ‘Observable’.

就是在Angular6中的rxjs 无法识别debounceTime()方法,将debounceTime(1000)修改为pipe(debounceTIme(1000))即可,同时import {debounceTime} from ‘rxjs/operators’; 问题即可解决。

参考:

/coco1989/p/9371629.html

/questions/49811177/angular-6-rxjs-import-syntax#answer-50342338

/ReactiveX/rxjs/issues/3723#issuecomment-390855559

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。