title: 'await' has no effect on the type of this expression when using await inside an if block
body: <p>In my code I have an array of user names. I'm trying to go through each name, check whether the user exist in the database and create the user. The problem is, my linter is saying <code>'await' has no effect on the type of this expression</code> in the places I have marked:</p>
  
  <pre class="lang-js prettyprint-override"><code>await Promise.all(
    userNames.map(async userName =&gt; {
      const user = await users.findOne({ name: userNames });
  
      if (!user)
        await users.create({ // Linter marks this bracket (Not the curly bracket)
          name: userName,
        }); // And this end bracket
    }),
  );
  </code></pre>
  
  <p>My editor suggests something like this:</p>
  
  <pre class="lang-js prettyprint-override"><code>  if (user) {
      return;
    }
    await users.create({
      name: userName,
    });
  </code></pre>
  
  <p>Flipping the if else. Any idea why?</p>