angularfire: automaticDataCollectionEnabled' is missing in type 'FirebaseApp'

Version info

Angular: 5.2.9

Firebase: ^4.13.0

AngularFire2: ^5.0.0-rc.6.0

**Other (e.g. Ionic/Cordova, Node, browser, operating system)šŸ˜—*Ionic/Cordova

How to reproduce these conditions

package.json

"dependencies": {
    "@angular/common": "5.2.9",
    "@angular/compiler": "5.2.9",
    "@angular/compiler-cli": "5.2.9",
    "@angular/core": "5.2.9",
    "@angular/forms": "5.2.9",
    "@angular/http": "5.2.9",
    "@angular/platform-browser": "5.2.9",
    "@angular/platform-browser-dynamic": "5.2.9",
    "@ionic-native/core": "4.7.0",
    "@ionic-native/splash-screen": "4.7.0",
    "@ionic-native/status-bar": "4.7.0",
    "@ionic/pro": "1.0.20",
    "@ionic/storage": "2.1.3",
    "angularfire2": "^5.0.0-rc.6.0",
    "firebase": "^4.13.0",
    "ionic-angular": "3.9.2",
    "ionicons": "3.0.0",
    "promise-polyfill": "^7.1.2",
    "rxjs": "5.5.8",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.26"
  },
  "devDependencies": {
    "@ionic/app-scripts": "3.1.9",
    "typescript": "~2.6.2"
  }

Debug output

Errors in the JavaScript console

typescript: node_modules/angularfire2/firebase.app.module.d.ts, line: 10 
            Class 'FirebaseApp' incorrectly implements interface 'FirebaseApp'. Property 
            'automaticDataCollectionEnabled' is missing in type 'FirebaseApp'. 

       L9:  export declare const FirebaseAppConfigToken: InjectionToken;
      L10:  export declare class FirebaseApp implements FBApp {
      L11:      name: string;

Expected behavior

Ionic compile would complete with any errors

Actual behavior

Because automaticDataCollectionEnabled is missing in type ā€˜FirebaseAppā€™, error occurs.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 8
  • Comments: 22 (2 by maintainers)

Most upvoted comments

Same issue solved as suggested aboveā€¦ At first, I had :

"dependencies": {
     "firebase":"^4.13.1",
     "angularfire2":"^5.0.0-rc.6"
}

Then after visiting here I did :

  1. npm uninstall firebase
  2. npm cache clean --force
  3. npm install firebase@4.12.1

As a result, it all works well for me. I got :

"dependencies": {
     "firebase":"^4.12.1",
     "angularfire2":"^5.0.0-rc.6"
}

I have installed "@firebase/app": "^0.1.10" and itā€™s working

Simple 1-line patch for lazy people like šŸ˜Š

sed -i.bak 's|^}$| automaticDataCollectionEnabled: false;}|' node_modules/angularfire2/firebase.app.module.d.ts

This issue is related to latest firebase update https://github.com/firebase/firebase-js-sdk/commit/7c1aa4470c0f5474b11fe57ada4edff65ed90adc

Temporary solution is to set version of firebase in your projects package.json to 4.12.1

"dependencies": {
     "firebase":"4.12.1",
     "angularfire2":"^5.0.0-rc.6"
}

export declare class FirebaseApp implements FBApp { name: string; options: {}; automaticDataCollectionEnabled: boolean; // this is the missing line auth: () => FirebaseAuth; database: () => FirebaseDatabase; messaging: () => FirebaseMessaging; storage: () => FirebaseStorage; delete: () => Promise<any>; firestore: () => FirebaseFirestore;} also: npm i -S @firebase/app source: https://stackoverflow.com/a/49968060/9692516

It worked for me, but with ā€˜npm cache cleanā€™ before installing

@Tamango92 actually I was using firebase 4.12.1. So it didnā€™t work for me. But I would solve this issue @zverbeta 's solution. Thank you. #1572 and I sent PR about this.

It is worked for @cicode225 ,Thanks a lot Same issue solved as suggested aboveā€¦ At first, I had :

ā€œdependenciesā€: { ā€œfirebaseā€:ā€œ^4.13.1ā€, ā€œangularfire2ā€:ā€œ^5.0.0-rc.6ā€ } Then after visiting here I did :

npm uninstall firebase npm clean cache --force npm install firebase@4.12.1 As a result, it all works well for me. I got :

ā€œdependenciesā€: { ā€œfirebaseā€:ā€œ^4.12.1ā€, ā€œangularfire2ā€:ā€œ^5.0.0-rc.6ā€ }