TypeScript错误:类型“ Navigator”上不存在属性“ app”

阿威达

我不断收到此错误:

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

在使用此代码时:

navigator.app.exitApp();

我有以下插件:

> <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"/>

我的代码可能出什么问题了?

纳什·法坎德(Nahush Farkande)

只需将应用程序属性添加到导航器界面

interface Navigator {
    app: {
        exitApp: () => any; // Or whatever is the type of the exitApp function
    }
}

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章