ОШИБКА в ../node_modules/rxjs/Subject.d.ts(24,5) - PullRequest
0 голосов
/ 15 апреля 2020

Эта проблема, которую я не мог решить раньше, появилась снова. Проект не работает, потому что я не мог решить его. Я пошел к указанному пути к файлу, у меня 2, и я поделился с вами кодами Как я могу исправить эту проблему?

rx js версия 6

машинописная версия 3.6.4

.error

ERROR in ../node_modules/rxjs/Subject.d.ts(24,5): error TS2416: 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'.

. subject.d.ts

import { Operator } from './Operator';
import { Observable } from './Observable';
import { Subscriber } from './Subscriber';
import { Subscription } from './Subscription';
import { Observer, SubscriptionLike, TeardownLogic } from './types';
/**
* @class SubjectSubscriber<T>
*/
export declare class SubjectSubscriber<T> extends Subscriber<T> {
protected destination: Subject<T>;
constructor(destination: Subject<T>);
}
/**
* A Subject is a special type of Observable that allows values to be
* multicasted to many Observers. Subjects are like EventEmitters.
*
* Every Subject is an Observable and an Observer. You can subscribe to a
* Subject, and you can call next to feed values as well as error and complete.
*
* @class Subject<T>
*/
export declare class Subject<T> extends Observable<T> implements SubscriptionLike {
observers: Observer<T>[];
closed: boolean;
isStopped: boolean;
hasError: boolean;
thrownError: any;
constructor();
/**@nocollapse
 * @deprecated use new Subject() instead
*/
static create: Function;
lift<R>(operator: Operator<T, R>): Observable<R>;
next(value?: T): void;
error(err: any): void;
complete(): void;
unsubscribe(): void;
/** @deprecated This is an internal implementation detail, do not use. */
_trySubscribe(subscriber: Subscriber<T>): TeardownLogic;
/** @deprecated This is an internal implementation detail, do not use. */
_subscribe(subscriber: Subscriber<T>): Subscription;
/**
 * Creates a new Observable with this Subject as the source. You can do this
 * to create customize Observer-side logic of the Subject and conceal it from
 * code that uses the Observable.
 * @return {Observable} Observable that the Subject casts to
 */
asObservable(): Observable<T>;
}
/**
* @class AnonymousSubject<T>
*/
export declare class AnonymousSubject<T> extends Subject<T> {
protected destination?: Observer<T>;
constructor(destination?: Observer<T>, source?: Observable<T>);
next(value: T): void;
error(err: any): void;
complete(): void;
/** @deprecated This is an internal implementation detail, do not use. */
_subscribe(subscriber: Subscriber<T>): Subscription;
}

другой файл subject.d.ts

export * from 'rxjs-compat/Subject';

1 Ответ

0 голосов
/ 16 апреля 2020

Вот как я решил проблему

Я обновил версии rx js в пакете. json файл.

"rxjs": "7.0.0-alpha.1",
"rxjs-compat": "^6.5.2",

Я добавил это в compilerOptions в tsconfig . json file

"skipLibCheck": true,

Я обновил версию машинописного текста

"typescript": "^3.1.2",
...