【发布时间】:2017-10-25 03:09:31
【问题描述】:
最近当我使用 Rxjs 5 时,我使用 npm install Rxjs@5.0.1 下载了 Rxjs,从 node_modules 下的下载代码中,我在 Rxjs 文件夹中找到了 Observable.d.ts,我看到它声明了它的构造函数,如下所示:
*
* @constructor
* @param {Function} subscribe the function that is called when the Observable is
* initially subscribed to. This function is given a Subscriber, to which new values
* can be `next`ed, or an `error` method can be called to raise an error, or
* `complete` can be called to notify of a successful completion.
*/
constructor(subscribe?: <R>(this: Observable<T>, subscriber: Subscriber<R>) => TeardownLogic);
我的问题是:这个关键字在 subscribe 的函数类型声明中的用法是什么?:(this: Observable, ...),TypeScript 是否有一些关于这个关键字用法的文档,例如这里?谢谢。
【问题讨论】:
标签: typescript rxjs5