angular - 'MonoTypeOperatorFunction 类型的参数' 不能分配给 'OperatorFunction 类型的参数'
问题描述
我正在使用rxjs/opterators
映射into valueChanges
,例如:FormControl
Observable
options$: Observable<any[]>;
ngOnInit() {
// update options$
this.options$ = this.inputCtrl.valueChanges.pipe(
startWith(null),
map(text => this.filter(text, value))
)
}
filter(text: string, list: any[]): any[] {
// set text in lowerCase for comparison
text = text.substr(index).trim().toLowerCase();
// filter list based on text
return list.filter(item => item.trim().toLowerCase().indexOf(text) !== -1);
}
但我不断收到此错误:
Argument of type 'MonoTypeOperatorFunction<any>' is not assignable to parameter of type 'OperatorFunction<any, any>'.
Types of parameters 'source' and 'source' are incompatible.
我搜索解决方案,我发现了这个问题,但它对我不起作用,因为我已经从 导入运算符rxjs/operators
,例如:
import { startWith, map } from 'rxjs/operators';
问题是什么?我该如何解决?
更新:
我第一个操作员收到此错误startWith
,我试图将其删除,但后来我得到了它map
!
解决方案
推荐阅读
- django - 如何在主页中的相应帖子下方显示评论
- android - 如何连接 webviewclient 和 Chromeweb 视图客户端
- python - 熊猫漂亮的汤桌出口
- oracle - oracle where 子句不适用于 sysdate
- javascript - 控制器 ActionResult 方法参数未从 ajax 调用接收表单数据
- php - android room not null 约束在插入时失败
- python - pd.read_table 字符串解析错误
- wso2 - wso2 esb 在 xslt 转换后注入很少的值
- c - C 编程更喜欢 uint8 而不是 char
- type-conversion - 将十六进制字符串转换为十进制数