Sergey Panfilov Sergey Panfilov - 1 year ago 734
Javascript Question

How to fight a lots of unresolved variables warning in Webstorm

Ok, I have a function which takes a data from ajax:

function getData(data){

Webstorm says that
- is unresolved variable.
I don't know what to do with lots of such warnings.

I see few options:

  • suppress warnings;

  • add a json source file with fields (more details);

  • use arrays-like syntax:
    warn me to didn't do this);

  • ???

Also Webstorm offering me to create namespace for the "data" (add an annotation like
/** @namespace data.some_unres_var*/
), create such field, or rename it.

Answer Source

Use JSDoc:

 * @param {{some_unres_var:string}} data
function getData(data){
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download