类型 'Subject<T>' 中的 属性 'lift' 不可分配给基本类型 'Observable<T>' 中的相同 属性
Property 'lift' in type 'Subject<T>' is not assignable to the same property in base type 'Observable<T>'
我在 Subject.d.ts
文件中收到有关 属性 lift
的错误,但不确定如何更正它。我正在使用 RxJS 版本 5.0.1.
Error TS2416 (TS) Property 'lift' in type 'Subject<T>' is not assignable to the same property in base type 'Observable<T>'.
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'.
'R' could be instantiated with an arbitrary type which could be unrelated to 'T'.
/**
* @class Subject<T>
*/
export declare class Subject<T> extends Observable<T> implements ISubscription {
observers: Observer<T>[];
closed: boolean;
isStopped: boolean;
hasError: boolean;
thrownError: any;
constructor();
static create: Function;
lift<R>(operator: Operator<T, R>): Observable<T>;
next(value?: T): void;
error(err: any): void;
complete(): void;
unsubscribe(): void;
protected _subscribe(subscriber: Subscriber<T>): Subscription;
asObservable(): Observable<T>;
}
RxJS 类型中的签名不正确并得到 fixed in v5.4.2: https://github.com/ReactiveX/rxjs/pull/2722/files。
因此解决方案是更新到 rxjs@5.4.2
。
我在 Subject.d.ts
文件中收到有关 属性 lift
的错误,但不确定如何更正它。我正在使用 RxJS 版本 5.0.1.
Error TS2416 (TS) Property 'lift' in type 'Subject<T>' is not assignable to the same property in base type 'Observable<T>'.
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'.
'R' could be instantiated with an arbitrary type which could be unrelated to 'T'.
/**
* @class Subject<T>
*/
export declare class Subject<T> extends Observable<T> implements ISubscription {
observers: Observer<T>[];
closed: boolean;
isStopped: boolean;
hasError: boolean;
thrownError: any;
constructor();
static create: Function;
lift<R>(operator: Operator<T, R>): Observable<T>;
next(value?: T): void;
error(err: any): void;
complete(): void;
unsubscribe(): void;
protected _subscribe(subscriber: Subscriber<T>): Subscription;
asObservable(): Observable<T>;
}
RxJS 类型中的签名不正确并得到 fixed in v5.4.2: https://github.com/ReactiveX/rxjs/pull/2722/files。
因此解决方案是更新到 rxjs@5.4.2
。