I am having a weird issue with my angular application, I just added AngularFire to my project, however when I try to put it up, it displays the following error:
ERROR in nodae_modules/@angular/fire/angularfire2.d.ts(37,49): error TS2344: Type 'T[K]' does not satisfy the constraint '(...args: any[]) => any'.
node_modules/@angular/fire/angularfire2.d.ts(40,49): error TS2344: Type 'T[K]' does not satisfy the constraint '(...args: any[]) => any'.
node_modules/@angular/fire/angularfire2.d.ts(48,78): error TS2344: Type 'T[K]' does not satisfy the constraint '(...args: any[]) => any'.
node_modules/@angular/fire/angularfire2.d.ts(48,107): error TS2344: Type 'T[K]' does not satisfy the constraint '(...args: any[]) => any'.
node_modules/@angular/fire/angularfire2.d.ts(50,75): error TS2344: Type 'T[K]' does not satisfy the constraint '(...args: any[]) => any'.
node_modules/@angular/fire/angularfire2.d.ts(50,96): error TS2344: Type 'T[K]' does not satisfy the constraint '(...args: any[]) => any'.
I am quite new in Angular and AngularFire, I assumed the it's kind of TypeScript issue so here's the tsconfig.json
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"module": "esnext",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2018",
"dom"
]}}
Can somebody help me with this?
Thanks in advance.
You have to set some options in tsconfig.json. The errors are from node_modules/@angular/fire/angularfire2.d.ts.
tsconfig:
{
//...
compilerOptions: {
"skipLibCheck": true,
//...
}
}
skipLibCheck: This option is to skip type checking of declaration files.
I found the core of the problem, my Ng version is 7.3.9 and AngularFire was 6.0.0 I had to downgrade the version to 5.4.2. This solved my problem perfectly.
Thank you developers for your help.
Advice: It's really important to check both versions before adding dependencies to the project.
If your Angular CLI: 7.2.3 version
add these dependencies
"@angular/fire": "^5.4.2",
"firebase": "^6.6.2",
"firebase-admin": "^8.9.2",
"fs-extra": "^9.0.1",
in package.json file and run
npm install
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With