Type 'T[K]' does not satisfy the constraint installing angular fire

Hi,
I’d like to use Firebase FCM in an Ionic4 app.
I’ve seen that a common way to do this is to use the @angular/fire library.

I have installed it in this way:

npm install @angular/fire firebase --save

But, when I start the app, I have this error:

[ng] ERROR in node_modules/@angular/fire/angularfire2.d.ts(37,49): error TS2344: Type 'T[K]' does not satisfy the constraint '(...args: any[]) => any'.
[ng] node_modules/@angular/fire/angularfire2.d.ts(40,49): error TS2344: Type 'T[K]' does not satisfy the constraint '(...args: any[]) => any'.
[ng] node_modules/@angular/fire/angularfire2.d.ts(48,78): error TS2344: Type 'T[K]' does not satisfy the constraint '(...args: any[]) => any'.
[ng] node_modules/@angular/fire/angularfire2.d.ts(48,107): error TS2344: Type 'T[K]' does not satisfy the constraint '(...args: any[]) => any'.
[ng] node_modules/@angular/fire/angularfire2.d.ts(50,75): error TS2344: Type 'T[K]' does not satisfy the constraint '(...args: any[]) => any'.
[ng] node_modules/@angular/fire/angularfire2.d.ts(50,96): error TS2344: Type 'T[K]' does not satisfy the constraint '(...args: any[]) => any'.
[ng] src/app/app.module.ts(63,26): error TS2307: Cannot find module '@ionic-native/firebase/ngx'.
[ng] src/app/services/fcmmanager.service.ts(2,26): error TS2307: Cannot find module '@ionic-native/firebase/ngx'.
[ng]

I can see that in the package.json file I have:

+    "@angular/fire": "^6.0.0",
+    "firebase": "^7.14.2",

Have you ever used this library?
What version of @angular/fire and firebase are you using and are compatible with Ionic4?

Thank you very much

Claudio

Hi @ioclaudio,

I just published an article in medium regarding this, the fix is at the end,

You just need to add just add “skipLibCheck”: true, in the “compilerOptions” (tsconfig)

2 Likes

Easy fix just go to your tsconfig.json and add a small line to sort this error. just add “skipLibCheck”: true, in the “compilerOptions” as per the snippet below:

{
  "compileOnSave": false,
  "compilerOptions": {
    //We need to add "skipLibCheck": true,
    "skipLibCheck": true,
    //end
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "module": "esnext",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "importHelpers": true,
    "target": "es2015",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2018",
      "dom"
    ]
  },
  "angularCompilerOptions": {
    "fullTemplateTypeCheck": true,
    "strictInjectionParameters": true
  }
}
2 Likes

this solution didnt work

Add this to your tsconfig.json :

compilerOptions: {
    ...
    "skipLibCheck": true
    ...
  }

It worked for me.
Answer found here

This solution works for me. Thank you!