Error: Property 'notification' does not exist on type 'Navigator'

北城以北 提交于 2021-02-19 04:23:05

问题


I'm attempting to use the ionic plugin cordova-plugin-dialogs, the plugin is working and I am able to call navigator.notification.alert() and create a native alert prompt but whenever my app builds, I get the following console error:

error TS2339: Property 'notification' does not exist on type 'Navigator'.

I read online that this could be related to types but I have confirmed that the types for this plugin are installed.


回答1:


The way I solved was to add this to my typings.json:

    "dialogs": "github:apache/cordova-plugin-dialogs/types/index.d.ts"

My project is old and still use typings. I use grunt to build, so I instal the typings.



来源:https://stackoverflow.com/questions/55732082/error-property-notification-does-not-exist-on-type-navigator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!