10

I'm using WebStorm 10.

When I use some lib like bluebird that make code like

var foo = require("foo"); // I will call foo.doSomething
Promise.promisifyAll(foo); 

foo.doSomethingAsync(...).then(...)

the doSomethingAsync will be marked as unresolved function inspection.

So what can I do something like config *Async in WebStorm to avoid unresolved function mark?

1
  • Sadly, it seems that there's no solution for that at the time, and it makes sense to assume there won't be any in the near future, as the newly created function isn't actually defined in the source..
    – Selfish
    Commented Jul 9, 2015 at 14:08

2 Answers 2

3

Best solution at the time is use namespace reserving. Webstorm supports using comments in order to mark stuff as legitimate:

    /** @namespace foo.doSomethingAsync */

    var foo =     Promise.promisifyAll(require('foo')); 
    foo.doSomethingAsync(...)
       .then(...)

This doesn't solve the actual issue, and won't get you suggestions for the arguments when using the function, but it's surely a convenience, helping clean up the insane amount of warnings generated when promisifying.

I hope this helps..

-1

Got a similar issue when working with TypeScript and Angular 2 (following its Heroes tutorial) using ES2015, but for the Promise object.

Promises are part of the Standard Built-in Objects, so I thought that WebStorm 2016 could use the TypeScript definitions and be able to get it, but by default it didn't. Everything worked except for this.

So, I went to Settings > Languages & Frameworks > JavaScript and changed the JavaScript language version to ECMAScript 6.

I thought that it would not having nothing to do since I was using TypeScript, but it does. Now the Promise object reference works and links to lib.es6.d.ts, which is an internal WebStorm definition of ES2015 objects for TypeScript.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.