Property 'plugins' does not exist on type 'Window'

I am getting this error while using paytm cordova (https://github.com/samyam-a/PayTM-PhoneGap-Plugin) plugin in ionic 2. Help me solve this.

Maybe window.plugins only exist when run in a real device or an emulator. Try wrap that code in an if sentence to avoid errors in development.

if(window.plugins){
    window.plugins.....
}

Or even better

import {Platform} from "ionic-angular";

Then

constructor(public platform: Platform){}

Finally

if(this.platform.is("cordova")){
    window.plugins.....
}

Anyway, try to run the code in a real device or an emulator and see what happens :slight_smile:

Edit:

I check the plugin source code and I see this line in plugin.xml

<js-module src="www/paytm.js" name="paytm">
    <clobbers target="window.plugins.paytm" />
</js-module>

If I’m not wrong, it means to inject www/paytm.js (the plugin javascript file) in window.plugins.payrm, but this is injected by cordova.js, so the plugin only runs in a real device/emulator

Thanks… tried but not able to build/run in emulator. Same error is consoled. Even my editor VS Code is marking the error. Before the build itself

Try to use the below

window[‘plugins’].paytm