Search code examples
visual-studiocordovatypescriptcordova-pluginsvisual-studio-cordova

Cannot use the class of installed plugin


I'm just tried Apache Cordova today, and I use Visual Studio

So, I created a project from blank Cordova project template that provided by Microsoft Visual Studio 2015.

And then I added test plugin (https://github.com/MSOpenTech/cordova-plugin-test) into the project via config.xml > Plugins > Custom > git, it's seems work fine, it show me notification that plugin has been installed.

However, when I add another custom plugin (I use https://github.com/toluhta/Immersify in this case) and type this code at onDeviceReady():

Immersify.enable(onImmersiveSuccess, onImmersiveFailed);

Visual Studio 2015 give me error:

TS2304  Build: Cannot find name 'Immersify'.
TS2304  Cannot find name 'Immersify'

I tried clearing Cordova Cache via Tools > Options > Tools for Apache Cordova > Cordova Tools and running Dependency Checker few times, still no luck

any ideas?


Solution

  • I've finally found out the answer.

    Since I created TypeScript Project instead of Javascript Project, it's seems the plugin isn't recognized

    I don't know if there is TypeScript Plugin, but switching project to Javascript project resolve the issue