Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 ?

like image 905
ubaltaci Avatar asked Mar 15 '26 18:03

ubaltaci


1 Answers

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
like image 78
gztomas Avatar answered Mar 18 '26 07:03

gztomas