angular - 无法在地图功能中推断类型
问题描述
作为将我的项目从 angular 5 迁移到 6 的一部分,我必须更新 RXJS6 做事的方式。
所以这
this.filteredList = this.autoComplete.valueChanges
.startWith(null)
.map(val => val ? this.filter(val) : this.list.slice());
改成这个
this.filteredList = this.autoComplete.valueChanges.pipe(
startWith(null),
map(val => val ? this.filter(val) : this.list.slice()));
似乎编译器无法再推断类型了
Severity Code Description Project File Line Suppression State
Error TS2345 (TS) Argument of type '{}' is not assignable to parameter of
type 'string'.
我对所有pipeable
操作员都得到了同样的结果——他们都不能说出他们正在接收的数据的类型。我该如何帮助它?
有趣的是,这似乎只是一个智能感知错误,代码可以编译并且工作正常。
解决方案
推荐阅读
- html - 为什么 ul 和第一个 li 元素之间有一个空格?
- syntax - SPSS为从字符串更改的数字变量添加了一个随机的“离散缺失值”
- c# - C# BackgroundWorker 在重启时吃掉内存
- javascript - 根据 2 个值将数组过滤为唯一?
- entity-framework - EF 条件查询以匹配任何可用信息不起作用
- rest - 是否可以在内部(私有)IIS 服务器上运行 Golang REST Web 应用程序?
- python - 一起打印函数调用函数
- java - 在 Android Studio 中实现扩展面板时出错
- continuous-integration - 是否可以禁止静音测试失败?
- scala - 关闭包装到 IO 中的 InputStream