4
由于我想开始使用Google Analytics Cordova plugin,但我正在使用TypeScript编写所有JavaScript资源,所以我遇到了一些障碍。下面是我在具体问题的一个很好的例子:在PhoneGap/Cordova插件中使用TypeScript
window.plugins.googleAnalyticsPlugin.startTrackerWithAccountID("UA-xxxxxxx-x");
打字稿不太愿意window.plugins
,抛出编译错误:
The property 'plugins' does not exist on value of type 'Window'.
这使得完整意义上的。但是,我无法通过使用declare var window;
语句来解决此问题,因为这会为窗口创建重复标识符。
太棒了,谢谢! –