Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Property 'automaticDataCollectionEnabled' is missing in type 'FirebaseApp'

We installed angular firebase with

npm install firebase angularfire2 --save

And this error occured

ERROR in node_modules/angularfire2/firebase.app.module.d.ts(10,22): error TS2420: Class 'FirebaseApp' incorrectly implements interface 'FirebaseApp'.
Property 'automaticDataCollectionEnabled' is missing in type 'FirebaseApp'.

How can I solved it?

like image 340
Midhilaj Avatar asked Apr 22 '18 06:04

Midhilaj


3 Answers

I would advise against modifying your node_modules directly. It is unnecessary and bad practise, as your changes will be overwritten by updates.

Op's error seems to occur when using a combination of the latest [email protected] and [email protected].

Solution:

Some suggest downgrading the firebase package, but a better option might be installing @firebase/app@^0.1.10 which fixed the errors in my case.

Note:

The latest firebase 4.13.1 introduces some changes to Firestore Timestamp/Date objects, that I had already implemented, and would have to revert if downgrading the firebase package.

like image 168
Zoon Avatar answered Oct 22 '22 08:10

Zoon


This work for me. Edit firebase.app.module.d.ts file

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 add @firebase/app

npm i -S @firebase/app

EDIT

The problem is solved by installing "angularfire2": "^5.0.0-rc.7"

Just run npm install angularfire2@latest

like image 11
Elizabeth Alcalá Avatar answered Oct 22 '22 08:10

Elizabeth Alcalá


Try to use these dependencies in package.json

"dependencies": {
 "firebase":"4.12.1",
 "angularfire2":"^5.0.0-rc.6",
 "@firebase/app": "^0.1.10" 
}
like image 5
Venkateswara Rao Avatar answered Oct 22 '22 09:10

Venkateswara Rao