1
votes

Im using the cordova-firebase-plugin in my ionic2 project Im using it for firebase analytics.

In my typeScript file when i try to call the function

window.FirebasePlugin.logEvent("page_view", {page: "Event List"});

I get the error

Property FirebasePlugin does not exist on type 'Window'

I guess that i have to import it. Ive already added it to my project by running the command

cordova plugin add [email protected] --save

And i cant find any reference to how to add this. Any help and I would be grateful

https://www.npmjs.com/package/cordova-plugin-firebase

2

2 Answers

3
votes

As long as you can not find a difintion file for it then you can just add the FirebasePlugin property to the window object:

interface Window {
    FirebasePlugin: any;
}
1
votes

Use declare var window; after your imports and Typescript won't complain anymore about properties inside window.