Can WebStorm be configured to warn when forgetting an await statement in a call to an async function?

It happens sometimes that you call an async function but forget the await statement. Such code usually does not render any warnings; instead, the following logic may simply fail.

Silly example:


async function foo() {

  return {a: 42};


const {a} = foo();


if (a === 42) {

  // do something



This will usually not render any warnings, and the if statement will compare undefined to 42, since a was dereferenced from a promise instead of from an object with a member called a.

In this example where the function is in the same file, it might produce a warning for the comparison ("always false when comparing Promise to Number"), but if the function is defined elsewhere this code may just seem fine and you might realize much later that you actually tried to operate on a promise instead of a resolved object resulting from awaiting a promise.


Now, of course sometimes you do want to store the promise itself and not it's resolved value, so "forgetting" await is not *always* wrong. 

Any thoughts around how this could be handled to detect developer errors earlier?



What WebStorm version do you use? 2019.2 shows a warning for such calls:


Hi, I noticed I am using 2019.1.

I will update ASAP and have a look!


Indeed, this helped. Thanks Elena!



Please sign in to leave a comment.