0
votes

I have been getting this error and I am not sure where I messed up. My "typescript": "~2.6.2" version

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;

Ionic Framework: 3.9.2

Ionic Native: ^2.9.0

Ionic App Scripts: 3.2.0

Angular Core: 5.2.11

Angular Compiler CLI: 5.2.11

Node: 8.12.0

OS Platform: macOS

Navigator Platform: MacIntel

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0)

This is my package.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"
 ]
 }
 }
2
It looks like you have two incompatible copies of rxjs installed. Can you please add your package.json file to the question so we can see how that happened? - Matt McCutchen
@MattMcCutchen I just added my package.json . Thank you - Adam
OK, I can see the incompatible copies of rxjs at node_modules/rxjs (5.5.12) and node_modules/ionic-native/node_modules/rxjs (5.0.1), but I'm unsure of the correct way to sort this out. Hopefully you get help from someone familiar with Ionic. If you're able to remove the ionic-native package and just rely on the newer @ionic-native/... packages that you already have installed, that will probably help. - Matt McCutchen

2 Answers

1
votes

Try to add:

"noStrictGenericChecks": true

to your tsconfig.json file;