Jefferson
Jefferson

Reputation: 43

Property 'lift' in type 'Subject<T>' is not assignable to the same property in base type 'Observable<T>'

I am getting this error about property lift in the Subject.d.ts file and not sure how to correct it. I am using RxJS version 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>;
}

Upvotes: 1

Views: 1327

Answers (1)

skink
skink

Reputation: 5736

The signature in the RxJS's typings was incorrect and got fixed in v5.4.2: https://github.com/ReactiveX/rxjs/pull/2722/files.

The solution is therefore to update to [email protected].

Upvotes: 1

Related Questions