rxjs/Subject.d.ts error : Class 'Subject' incorrectly extends base class 'Observable'

前端 未结 19 1920
一向
一向 2020-12-01 09:55

I extracted sample template code from this tutorial and did below two steps to get started -

  1. npm install // worked fine and created node_modules folder
相关标签:
19条回答
  • 2020-12-01 10:46

    Keep the noStrictGeneric option true in tsconfig.config file

    {
        "compilerOptions": {
            "noStrictGenericChecks": true
        }
    }
    
    0 讨论(0)
  • 2020-12-01 10:48

    I found same problem and I solved it by using "rxjs": "5.4.1", "typescript": "~2.4.0" and adding "noStrictGenericChecks": true into tsconfig.json.

    0 讨论(0)
  • 2020-12-01 10:49

    Now we dont need the ionic-native module - we only need @ionic-native/core. Run

    npm uninstall ionic-native --save
    

    It will solve Your Problem..

    0 讨论(0)
  • 2020-12-01 10:52

    An admitted band-aid approach is to add the following to your tsconfig.json file until the RxJS folks decide what they want to do about the error when using TypeScript 2.4.1 :

    "compilerOptions": {
    
        "skipLibCheck": true,
    
     }
    
    0 讨论(0)
  • 2020-12-01 10:54

    RxJS 6 will have this fixed, but as a temporary workaround, you can use the noStrictGenericChecks compiler option.

    In tsconfig.json, put it in compilerOptions and set it to true.

    {
        "compilerOptions": {
            "noStrictGenericChecks": true
        }
    }
    

    On the command line it's --noStrictGenericChecks.

    Why it's happening:

    TypeScript 2.4 has a strictness change, and Subject isn't lifting to the correct Observable. The signature really should have been

    (operator: Operator) => Observable

    This will be fixed in RxJS 6.

    0 讨论(0)
  • 2020-12-01 10:55

    Add "noStrictGenericChecks": true in tsconfig.json file under "compilerOptions" node as shown in below image & build application. I have faced same error after adding this error resolved.

    0 讨论(0)
提交回复
热议问题