Error TS2339: Property 'diagnostic' does not exist on type 'CordovaPlugins'

Hi All,

I followed this, and did the following:

cordova plugin add cordova.plugins.diagnostic
npm install -g typings 
typings install dt~cordova --save --global


if (window.cordova && cordova.plugins) {
  cordova.plugins.diagnostic.isLocationEnabled(function (enabled) {
    alert("Location is " + (enabled ? "enabled" : "disabled"));
  }, function (error) {
    alert("The following error occurred: " + error);


I get the following error:

error TS2339: Property 'diagnostic' does not exist on type 'CordovaPlugins'.

I notice that window.cordova is undefined.

If anyone can advise how I can get the Cordova Plugin working, I would appreciate it.


Can someone recommend a different plugin that works with Ionic 2 to determine if the GPS is turned on?