当我编译时,在RxJS声明文件中出现以下编译器错误:
node_modules/rxjs/Subject.d.ts(16,22): error TS2415: Class 'Subject<T>' incorrectly extends base class 'Observable<T>'.
Types of property 'lift' are incompatible.
Type '<R>(operator: Operator<T, R>) => Observable<T>' is not assignable to type '<R>(operator: Operator<T, R>) => Observable<R>'.
Type 'Observable<T>' is not assignable to type 'Observable<R>'.
Type 'T' is not assignable to type 'R'.
这里发生了什么事情,我该如何解决而不降级到 TypeScript 2.3 或更早的版本?
tsconfig.json
文件中,compilerOptions
的设置。只需移除破折号并将其设为true
。 - Daniel Rosenwasser