【发布时间】:2017-08-13 06:50:43
【问题描述】:
当我浏览 rxjs 库时,我偶然发现了这个函数:
export function map<T, R>(this: Observable<T>, project: (value: T, index: number) => R, thisArg?: any): Observable<R> {
if (typeof project !== 'function') {
throw new TypeError('argument is not a function. Are you looking for `mapTo()`?');
}
return this.lift(new MapOperator(project, thisArg));
}
来源:https://github.com/ReactiveX/rxjs/blob/master/src/operator/map.ts
我想知道当传递一个名为 this 的参数时会发生什么。
它只是像任何其他参数一样被处理,还是在您执行此操作时会打字一些特殊动作?
【问题讨论】:
标签: typescript rxjs5