title: JS: async function implicitly unwraps promise?
body: <p>To the best of my knowledge async functions wrap their returned value into a promise implicitly. This does work for every property, except Promises themselfs.</p>
  
  <pre class="lang-js prettyprint-override"><code>async function f() {
    return new Promise((res) =&gt; {
      setTimeout(() =&gt; {
        res("Why am I being unwrapped")
      }, 1000)
    })
  }
  
  (async () =&gt; {
    console.log(await f())
  })()
  </code></pre>
  
  <p>Those get unwrapped before being returned. So that <code>await f()</code> actually awaits two nested promises.</p>
  
  <blockquote>
    <p>Note that this also works with explicitly createded Promises (<code>Promise.resolve(new Promise(...))</code>)</p>
  </blockquote>
  
  <p>Is there a <strong>good</strong> way to avoid this? I would really like to have a nested Promise without a quickfix like so.</p>
  
  <pre class="lang-js prettyprint-override"><code>async function y() {
    return {wrapped: new Promise((res) =&gt; {
      setTimeout(() =&gt; {
        res("Why am I being unwrapped")
      }, 1000)
    })}
  }
  
  (async () =&gt; {
    console.log((await y()).wrapped)
  })()
  </code></pre>
  
  <p><a href="https://codesandbox.io/s/crazy-mclean-bqbgw?file=/src/index.js" rel="nofollow noreferrer">Sandbox</a></p>