<p dir="auto">When trying to use object spread in function parameters with default parameter present, transform-object-rest-spread doesn't apply.</p>
<h3 dir="auto">Input Code</h3>


<p dir="auto"><a href="https://babeljs.io/repl/#?babili=false&amp;evaluate=true&amp;lineWrap=false&amp;presets=stage-3&amp;experimental=false&amp;loose=false&amp;spec=false&amp;code=const%20a%20%3D%20(%7B%20x%2C%20...rest%20%7D)%20%3D%3E%20%7B%7D%3B%0Aconst%20b%20%3D%20(%7B%20x%2C%20...rest%20%7D%20%3D%20%7B%7D)%20%3D%3E%20%7B%7D%3B%0A" rel="nofollow">Minimal test case in REPL</a> . Transform doesn't apply after adding default parameter.</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="const b = ({ x, ...rest } = {}) =&gt; {};"><pre class="notranslate"><span class="pl-k">const</span> <span class="pl-en">b</span> <span class="pl-c1">=</span> <span class="pl-kos">(</span><span class="pl-kos">{</span> x<span class="pl-kos">,</span> ...<span class="pl-s1">rest</span> <span class="pl-kos">}</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span><span class="pl-kos">}</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span><span class="pl-kos">}</span><span class="pl-kos">;</span></pre></div>
<h3 dir="auto">Babel Configuration (.babelrc, package.json, cli command)</h3>

<h3 dir="auto">Expected Behavior</h3>

<p dir="auto">Transform applies also when default parameter is present.</p>

<h3 dir="auto">Current Behavior</h3>

<p dir="auto">Transform doesn't apply when default parameter is present.</p>

<h3 dir="auto">Possible Solution</h3>


<h3 dir="auto">Context</h3>

<p dir="auto">I was trying to use object-rest-spread in node 6 without babel plugins for natively supported ES6 features.</p>

<h3 dir="auto">Your Environment</h3>

<table role="table">
<thead>
<tr>
<th>software</th>
<th>version</th>
</tr>
</thead>
<tbody>
<tr>
<td>Babel</td>
<td></td>
</tr>
<tr>
<td>node</td>
<td></td>
</tr>
<tr>
<td>npm</td>
<td></td>
</tr>
<tr>
<td>Operating System</td>
<td></td>
</tr>
</tbody>
</table>
<p dir="auto">With latest <code class="notranslate">transform-object-rest-spread</code> <code class="notranslate">6.19.0</code> and without <code class="notranslate">transform-es2015-destructuring</code>, <code class="notranslate">transform-es2015-parameters</code>, such code:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="function fn({a = 1, ...b} = {}) {
  return {a, b};
}"><pre class="notranslate"><span class="pl-k">function</span> <span class="pl-en">fn</span><span class="pl-kos">(</span><span class="pl-kos">{</span>a <span class="pl-c1">=</span> <span class="pl-c1">1</span><span class="pl-kos">,</span> ...<span class="pl-s1">b</span><span class="pl-kos">}</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span><span class="pl-kos">}</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-k">return</span> <span class="pl-kos">{</span>a<span class="pl-kos">,</span> b<span class="pl-kos">}</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">remains the same after transformation</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="function fn({a = 1, ...b} = {}) {
  return {a, b};
}"><pre class="notranslate"><span class="pl-k">function</span> <span class="pl-en">fn</span><span class="pl-kos">(</span><span class="pl-kos">{</span>a <span class="pl-c1">=</span> <span class="pl-c1">1</span><span class="pl-kos">,</span> ...<span class="pl-s1">b</span><span class="pl-kos">}</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span><span class="pl-kos">}</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-k">return</span> <span class="pl-kos">{</span>a<span class="pl-kos">,</span> b<span class="pl-kos">}</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">Without default object <code class="notranslate"> = {}</code> it is transformed as expected to</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="function fn(_ref) {
  let { a = 1 } = _ref;
  let b = (0, _objectWithoutProperties3.default)(_ref, [&quot;a&quot;]);

  return { a, b };
}
}"><pre class="notranslate"><span class="pl-k">function</span> <span class="pl-en">fn</span><span class="pl-kos">(</span><span class="pl-s1">_ref</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-k">let</span> <span class="pl-kos">{</span> a <span class="pl-c1">=</span> <span class="pl-c1">1</span> <span class="pl-kos">}</span> <span class="pl-c1">=</span> <span class="pl-s1">_ref</span><span class="pl-kos">;</span>
  <span class="pl-k">let</span> <span class="pl-s1">b</span> <span class="pl-c1">=</span> <span class="pl-kos">(</span><span class="pl-c1">0</span><span class="pl-kos">,</span> <span class="pl-s1">_objectWithoutProperties3</span><span class="pl-kos">.</span><span class="pl-c1">default</span><span class="pl-kos">)</span><span class="pl-kos">(</span><span class="pl-s1">_ref</span><span class="pl-kos">,</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-kos">;</span>

  <span class="pl-k">return</span> <span class="pl-kos">{</span> a<span class="pl-kos">,</span> b <span class="pl-kos">}</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>
<span class="pl-kos">}</span></pre></div>
<h3 dir="auto">Babel Configuration (.babelrc)</h3>

<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
  plugins: [
     ['transform-object-rest-spread', {useBuiltIns: true}]
  ]
}"><pre class="notranslate"><span class="pl-kos">{</span>
  <span class="pl-c1">plugins</span>: <span class="pl-kos">[</span>
     <span class="pl-kos">[</span><span class="pl-s">'transform-object-rest-spread'</span><span class="pl-kos">,</span> <span class="pl-kos">{</span><span class="pl-c1">useBuiltIns</span>: <span class="pl-c1">true</span><span class="pl-kos">}</span><span class="pl-kos">]</span>
  <span class="pl-kos">]</span>
<span class="pl-kos">}</span></pre></div>