<p dir="auto">test case:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="function test(a) {
  return a * 2;
}

var cb = async (...args) =&gt; await test(...args);

cb(123)
  .then((result) =&gt; console.log(result))
  .catch((e) =&gt; console.error(e));"><pre class="notranslate"><span class="pl-k">function</span> <span class="pl-en">test</span><span class="pl-kos">(</span><span class="pl-s1">a</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-k">return</span> <span class="pl-s1">a</span> <span class="pl-c1">*</span> <span class="pl-c1">2</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-k">var</span> <span class="pl-en">cb</span> <span class="pl-c1">=</span> <span class="pl-k">async</span> <span class="pl-kos">(</span>...<span class="pl-s1">args</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-k">await</span> <span class="pl-en">test</span><span class="pl-kos">(</span>...<span class="pl-s1">args</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

<span class="pl-en">cb</span><span class="pl-kos">(</span><span class="pl-c1">123</span><span class="pl-kos">)</span>
  <span class="pl-kos">.</span><span class="pl-en">then</span><span class="pl-kos">(</span><span class="pl-kos">(</span><span class="pl-s1">result</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">result</span><span class="pl-kos">)</span><span class="pl-kos">)</span>
  <span class="pl-kos">.</span><span class="pl-en">catch</span><span class="pl-kos">(</span><span class="pl-kos">(</span><span class="pl-s1">e</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">error</span><span class="pl-kos">(</span><span class="pl-s1">e</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">expected result: <code class="notranslate">246</code><br>
actual result: <code class="notranslate">NaN</code></p>
<p dir="auto">for example, <a href="http://babeljs.io/docs/advanced/transformers/other/bluebird-coroutines/" rel="nofollow">http://babeljs.io/docs/advanced/transformers/other/bluebird-coroutines/</a> in this case do work as expected</p>
<p dir="auto">Hi,</p>
<p dir="auto">It seems there is a bug when combining async + rest parameters syntax.<br>
Here is a simplified version that reproduces the case with a simple async of value.</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="const foo = async (...msgs) =&gt; {
  let t = await msgs[0];
  console.log(t);
}

foo('a'); // displays &quot;{}&quot; instead of &quot;a&quot; value"><pre class="notranslate"><span class="pl-k">const</span> <span class="pl-en">foo</span> <span class="pl-c1">=</span> <span class="pl-k">async</span> <span class="pl-kos">(</span>...<span class="pl-s1">msgs</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
  <span class="pl-k">let</span> <span class="pl-s1">t</span> <span class="pl-c1">=</span> <span class="pl-k">await</span> <span class="pl-s1">msgs</span><span class="pl-kos">[</span><span class="pl-c1">0</span><span class="pl-kos">]</span><span class="pl-kos">;</span>
  <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">t</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-en">foo</span><span class="pl-kos">(</span><span class="pl-s">'a'</span><span class="pl-kos">)</span><span class="pl-kos">;</span> <span class="pl-c">// displays "{}" instead of "a" value</span></pre></div>
<p dir="auto">Just by adding <code class="notranslate">console.log(msgs)</code>, it makes it work.</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="const foo = async (...msgs) =&gt; {
  console.log(msgs);
  let t = await msgs[0];
  console.log(t);
}

foo('a'); // displays &quot;a&quot; "><pre class="notranslate"><span class="pl-k">const</span> <span class="pl-en">foo</span> <span class="pl-c1">=</span> <span class="pl-k">async</span> <span class="pl-kos">(</span>...<span class="pl-s1">msgs</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
  <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">msgs</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-k">let</span> <span class="pl-s1">t</span> <span class="pl-c1">=</span> <span class="pl-k">await</span> <span class="pl-s1">msgs</span><span class="pl-kos">[</span><span class="pl-c1">0</span><span class="pl-kos">]</span><span class="pl-kos">;</span>
  <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">t</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-en">foo</span><span class="pl-kos">(</span><span class="pl-s">'a'</span><span class="pl-kos">)</span><span class="pl-kos">;</span> <span class="pl-c">// displays "a" </span></pre></div>
<p dir="auto">Basically, adding <code class="notranslate">console.log(msgs)</code> moves the args to a distinct array:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="for (var _len = arguments.length, msgs = Array(_len), _key = 0; _key &lt; _len; _key++) {
    msgs[_key] = arguments[_key];
  }"><pre class="notranslate"><code class="notranslate">for (var _len = arguments.length, msgs = Array(_len), _key = 0; _key &lt; _len; _key++) {
    msgs[_key] = arguments[_key];
  }
</code></pre></div>
<p dir="auto">In the repl:<br>
<a href="https://babeljs.io/repl/#?experimental=true&amp;evaluate=true&amp;loose=false&amp;spec=false&amp;code=const%20asyncArg%20%3D%20async%20(msg)%20%3D%3E%20%7B%0D%0A%20%20let%20t%20%3D%20await%20msg%3B%0D%0A%20%20console.log(t)%3B%0D%0A%7D%0D%0A%0D%0Aconst%20asyncArgs%20%3D%20async%20(...msgs)%20%3D%3E%20%7B%0D%0A%20%20let%20t%20%3D%20await%20msgs%5B0%5D%3B%0D%0A%20%20console.log(t)%3B%0D%0A%7D%0D%0A%0D%0AasyncArg('1')%3B%0D%0AasyncArgs('2')%3B%0D%0A" rel="nofollow">https://babeljs.io/repl/#?experimental=true&amp;evaluate=true&amp;loose=false&amp;spec=false&amp;code=const%20asyncArg%20%3D%20async%20(msg)%20%3D%3E%20%7B%0D%0A%20%20let%20t%20%3D%20await%20msg%3B%0D%0A%20%20console.log(t)%3B%0D%0A%7D%0D%0A%0D%0Aconst%20asyncArgs%20%3D%20async%20(...msgs)%20%3D%3E%20%7B%0D%0A%20%20let%20t%20%3D%20await%20msgs%5B0%5D%3B%0D%0A%20%20console.log(t)%3B%0D%0A%7D%0D%0A%0D%0AasyncArg('1')%3B%0D%0AasyncArgs('2')%3B%0D%0A</a></p>