【发布时间】:2018-10-16 21:51:22
【问题描述】:
我正在尝试在 typescript 上编写组件,将 props 中的 onChange 替换为 rxjs 实现 onChange,如下所示
this.onChangeSubscription = this.onChange$
.debounceTime(200)
.filter(value => value.length !== 1)
.distinctUntilChanged()
.subscribe(value => this.props.onChange(value))
当我尝试使用 pluck 函数时出现错误:
Subscribable 类型上不存在属性“pluck”
const Filter = mapPropsStream<Props,Props>((props$) => {
const a = props$.pluck('onChange');
// newProps created
return newProps$;
})(Component);
导入包含
import 'rxjs/add/operator/pluck';
【问题讨论】:
标签: typescript rxjs recompose