打字稿错误类'Subject<T>'错误地扩展了基类"可观察<T>"。不兼容的属性'lift'类型



我一直收到这个错误,我不确定我把哪里搞砸了。我的"打字脚本":"~2.6.2"版本

Typescript Error
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'.

node_modules/ionic-native/node_modules/rxjs/Subject.d.ts
*/
export declare class Subject<T> extends Observable<T> implements 
ISubscription {
observers: Observer<T>[];
Typescript Error
Class 'WebSocketSubject<T>' incorrectly extends base class 'AnonymousSubject<T>'. Types of property 'lift' are incompatible. Type '<R>(operator: Operator<T, R>) => WebSocketSubject<R>' is not assignable to type '<R>(operator: Operator<T, R>) => Observable<T>'. Type 'WebSocketSubject<R>' is not assignable to type 'Observable<T>'. Types of property 'operator' are incompatible. Type 'Operator<any, R>' is not assignable to type 'Operator<any, T>'. Type 'R' is not assignable to type 'T'.
node_modules/ionic- 
native/node_modules/rxjs/observable/dom/WebSocketSubject.d.ts
*/
export declare class WebSocketSubject<T> extends AnonymousSubject<T> {
url: string;

离子框架:3.9.2

Ionic Native:^2.9.0

Ionic应用程序脚本:3.2.0

角芯:5.2.11

Angular编译器CLI:5.211

节点:8.12.0

操作系统平台:macOS

导航平台:MacIntel

用户代理:Mozilla/5.0(Macintosh;Intel Mac OS X 10_14_0(

这是我的包.json

{
"name": "458",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"start": "ionic-app-scripts serve",
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint"
},
"dependencies": {
"@angular/animations": "5.2.11",
"@angular/common": "5.2.11",
"@angular/compiler": "5.2.11",
"@angular/compiler-cli": "5.2.11",
"@angular/core": "5.2.11",
"@angular/forms": "5.2.11",
"@angular/http": "5.2.11",
"@angular/platform-browser": "5.2.11",
"@angular/platform-browser-dynamic": "5.2.11",
"@ionic-native/base64": "^4.16.0",
"@ionic-native/core": "~4.12.0",
"@ionic-native/image-picker": "^4.16.0",
"@ionic-native/splash-screen": "~4.12.0",
"@ionic-native/status-bar": "~4.12.0",
"@ionic/pro": "2.0.3",
"@ionic/storage": "2.2.0",
"angularfire2": "^5.0.2",
"com-badrit-base64": "^0.2.0",
"cordova-android": "7.0.0",
"cordova-ios": "4.5.5",
"cordova-plugin-camera": "^4.0.3",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-file": "^6.0.1",
"cordova-plugin-ionic-keyboard": "^2.1.3",
"cordova-plugin-ionic-webview": "^2.2.0",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-telerik-imagepicker": "^2.2.2",
"cordova-plugin-whitelist": "^1.3.3",
"firebase": "^5.5.6",
"ionic": "^4.1.2",
"ionic-angular": "3.9.2",
"ionic-img-viewer": "^2.9.0",
"ionic-native": "^2.9.0",
"ionicons": "3.0.0",
"rxjs": "^5.5.11",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.26"
},
"devDependencies": {
"@ionic/app-scripts": "3.2.0",
"typescript": "~2.6.2"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-telerik-imagepicker": {
"PHOTO_LIBRARY_USAGE_DESCRIPTION": "your usage message"
},
"cordova-plugin-whitelist": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-webview": {},
"cordova-plugin-ionic-keyboard": {},
"com-badrit-base64": {},
"cordova-plugin-file": {},
"cordova-plugin-camera": {}
},
"platforms": [
"ios",
"android"
]
}
}

尝试添加:

"noStrictGenericChecks":真实

到您的tsconfig.json文件;

我该如何解决这一问题"主题错误地扩展了Observable";TypeScript 2.4和RxJS 5.x中出现错误?

这可能会有所帮助。如果没有,请尝试在编译器选项中将skipLibCheck设置为false。

相关内容

最新更新