Aweda Aweda - 1 year ago 267
TypeScript Question

TypeScript error: Property 'app' does not exist on type 'Navigator'

I keep getting this error:

> TypeScript error: Property 'app' does not exist on type 'Navigator'

while using this code:;

I have the following plugins:

> <plugin name="cordova-plugin-device" spec="~1.1.2"/>
> <plugin name="cordova-plugin-console" spec="~1.0.3"/>
> <plugin name="cordova-plugin-whitelist" spec="~1.2.2"/>
> <plugin name="cordova-plugin-splashscreen" spec="~3.2.2"/>
> <plugin name="cordova-plugin-statusbar" spec="~2.1.3"/>
> <plugin name="ionic-plugin-keyboard" spec="~2.2.1"/>

What might be wrong with my code?

Answer Source

Just add an app property to the Navigator interface

interface Navigator {
    app: {
        exitApp: () => any; // Or whatever is the type of the exitApp function
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download