ubaltaci
ubaltaci

Reputation: 1016

Webstorm don't recognize node.js third party modules

I tried in both Webstorm 6 and 7 EAP,

Auto-completion works fine but something strange happened,

var SyParams = require('../params');
....
SyParams.kioskParams ( IDE gives warning, 'unresolved variable kioskParams' )

If I write 'require' like this;

var SyParams = new require('../params');

Everything looks good, is there a solution for that ?

Upvotes: 3

Views: 730

Answers (1)

gztomas
gztomas

Reputation: 3260

It seems that the '..\params' module is exporting a constructor function that constructs an object which has kioskParams as an attribute. And the constructor itself doesn't have an attribute called kioskParams. It can be easier understood if you write it like this:

var SyParams = require('../params'); // The module exports a constructor
...

var syParams = new SyParams(); // You construct the actual object
syParams.kioskParams; //Then you access its members

Upvotes: 1

Related Questions