Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

navigator.app.exitApp();

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?

like image 618
Aweda Avatar asked Oct 17 '16 09:10

Aweda


1 Answers

Just add an app property to the Navigator interface

interface Navigator {
    app: {
        exitApp: () => any; // Or whatever is the type of the exitApp function
    }
}
like image 112
Nahush Farkande Avatar answered Nov 02 '22 22:11

Nahush Farkande