<h2 dir="auto">Bug Report</h2>
<p dir="auto"><strong>Current Behavior</strong><br>
I've updated to 7.5 and have been following the developments with issues that should have been resolved with <a href="https://github.com/babel/babel/releases/tag/v7.5.1">https://github.com/babel/babel/releases/tag/v7.5.1</a> however after stripping and reinstalling everything babel-related, I'm still getting this error.</p>
<p dir="auto"><strong>Babel packages</strong><br>
@babel/cli: "^7.5.0"<br>
@babel/core: "^7.5.0"<br>
@babel/helpers: "^7.5.1"<br>
@babel/plugin-proposal-object-rest-spread: "^7.5.1"<br>
@babel/plugin-transform-runtime: "^7.5.0"<br>
@babel/polyfill: "^7.4.4"<br>
@babel/preset-env: "^7.5.0"<br>
@babel/preset-react: "^7.0.0"<br>
babel-eslint: "^10.0.2"<br>
babel-jest: "^24.8.0"<br>
babel-loader: "^8.0.6"<br>
babel-plugin-dynamic-import-node: "^2.3.0"<br>
babel-plugin-jsx-remove-data-test-id: "^2.0.0"<br>
babel-plugin-transform-class-properties: "^6.24.1"<br>
babel-plugin-transform-decorators-legacy: "^1.3.5"<br>
babel-plugin-transform-export-extensions: "^6.22.0"<br>
babel-plugin-transform-object-rest-spread: "^6.26.0"</p>
<p dir="auto"><strong>Babel Configuration (.babelrc, package.json, cli command)</strong></p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
  &quot;env&quot;: {
    &quot;test&quot;: {
      &quot;plugins&quot;: [
        &quot;transform-class-properties&quot;,
        &quot;dynamic-import-node&quot;,
        &quot;@babel/plugin-transform-runtime&quot;
      ]
    },
    &quot;production&quot;: {
      &quot;plugins&quot;: [&quot;babel-plugin-jsx-remove-data-test-id&quot;]
    }
  },
  &quot;presets&quot;: [&quot;@babel/preset-env&quot;, &quot;@babel/preset-react&quot;],
  &quot;plugins&quot;: [&quot;transform-class-properties&quot;]
}
"><pre class="notranslate"><span class="pl-kos">{</span>
  <span class="pl-s">"env"</span>: <span class="pl-kos">{</span>
    <span class="pl-s">"test"</span>: <span class="pl-kos">{</span>
      <span class="pl-s">"plugins"</span>: <span class="pl-kos">[</span>
        <span class="pl-s">"transform-class-properties"</span><span class="pl-kos">,</span>
        <span class="pl-s">"dynamic-import-node"</span><span class="pl-kos">,</span>
        <span class="pl-s">"@babel/plugin-transform-runtime"</span>
      <span class="pl-kos">]</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-s">"production"</span>: <span class="pl-kos">{</span>
      <span class="pl-s">"plugins"</span>: <span class="pl-kos">[</span><span class="pl-s">"babel-plugin-jsx-remove-data-test-id"</span><span class="pl-kos">]</span>
    <span class="pl-kos">}</span>
  <span class="pl-kos">}</span><span class="pl-kos">,</span>
  <span class="pl-s">"presets"</span>: <span class="pl-kos">[</span><span class="pl-s">"@babel/preset-env"</span><span class="pl-kos">,</span> <span class="pl-s">"@babel/preset-react"</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
  <span class="pl-s">"plugins"</span>: <span class="pl-kos">[</span><span class="pl-s">"transform-class-properties"</span><span class="pl-kos">]</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto"><strong>Environment</strong></p>
<ul dir="auto">
<li>Babel version(s): 7.5.0</li>
<li>Node/npm version: 6.5.0</li>
<li>OS: Linux Mint Cinnamon</li>
<li>Monorepo: yes</li>
</ul>
<h3 dir="auto">Input Code</h3>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="const user = { name: 'Max', password: '123', _id: 1, __v: 42 }
const fields = ['__v', 'password']
const filtered = fields.reduce((a, c) =&gt; (({ [c]: _, ...rest } = a), rest), user)"><pre class="notranslate"><span class="pl-k">const</span> <span class="pl-s1">user</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span> <span class="pl-c1">name</span>: <span class="pl-s">'Max'</span><span class="pl-kos">,</span> <span class="pl-c1">password</span>: <span class="pl-s">'123'</span><span class="pl-kos">,</span> <span class="pl-c1">_id</span>: <span class="pl-c1">1</span><span class="pl-kos">,</span> <span class="pl-c1">__v</span>: <span class="pl-c1">42</span> <span class="pl-kos">}</span>
<span class="pl-k">const</span> <span class="pl-s1">fields</span> <span class="pl-c1">=</span> <span class="pl-kos">[</span><span class="pl-s">'__v'</span><span class="pl-kos">,</span> <span class="pl-s">'password'</span><span class="pl-kos">]</span>
<span class="pl-k">const</span> <span class="pl-s1">filtered</span> <span class="pl-c1">=</span> <span class="pl-s1">fields</span><span class="pl-kos">.</span><span class="pl-en">reduce</span><span class="pl-kos">(</span><span class="pl-kos">(</span><span class="pl-s1">a</span><span class="pl-kos">,</span> <span class="pl-s1">c</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> <span class="pl-kos">[</span><span class="pl-s1">c</span><span class="pl-kos">]</span>: <span class="pl-s1">_</span><span class="pl-kos">,</span> ...<span class="pl-s1">rest</span> <span class="pl-kos">}</span> <span class="pl-c1">=</span> <span class="pl-s1">a</span><span class="pl-kos">)</span><span class="pl-kos">,</span> <span class="pl-s1">rest</span><span class="pl-kos">)</span><span class="pl-kos">,</span> <span class="pl-s1">user</span><span class="pl-kos">)</span></pre></div>
<p dir="auto">this code compiled and works as expected on <strong>node</strong>, but fails on <strong>babel</strong></p>
<h3 dir="auto">Babel/Babylon Configuration (.babelrc, package.json, cli command)</h3>
<p dir="auto">Using babel 6.26.0</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="package.json
...
  &quot;devDependencies&quot;: {
    &quot;babel&quot;: &quot;^6.23.0&quot;,
    &quot;babel-cli&quot;: &quot;^6.26.0&quot;,
    &quot;babel-core&quot;: &quot;^6.26.0&quot;,
    &quot;babel-plugin-transform-object-rest-spread&quot;: &quot;^6.26.0&quot;,
    &quot;babel-preset-env&quot;: &quot;^1.6.1&quot;
  }"><pre class="notranslate"><span class="pl-s1">package</span><span class="pl-kos">.</span><span class="pl-c1">json</span>
<span class="pl-kos">.</span><span class="pl-kos">.</span><span class="pl-kos">.</span>
  <span class="pl-s">"devDependencies"</span>: <span class="pl-kos">{</span>
    <span class="pl-s">"babel"</span>: <span class="pl-s">"^6.23.0"</span><span class="pl-kos">,</span>
    <span class="pl-s">"babel-cli"</span>: <span class="pl-s">"^6.26.0"</span><span class="pl-kos">,</span>
    <span class="pl-s">"babel-core"</span>: <span class="pl-s">"^6.26.0"</span><span class="pl-kos">,</span>
    <span class="pl-s">"babel-plugin-transform-object-rest-spread"</span>: <span class="pl-s">"^6.26.0"</span><span class="pl-kos">,</span>
    <span class="pl-s">"babel-preset-env"</span>: <span class="pl-s">"^1.6.1"</span>
  <span class="pl-kos">}</span></pre></div>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">Get filtered user without <code class="notranslate">__v</code> and <code class="notranslate">password</code> fields</p>
<h3 dir="auto">Current Behavior</h3>
<p dir="auto">Cannot compile code. Output log:</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$ babel --plugins transform-object-rest-spread src/index.js
babel-preset-env: `DEBUG` option

Using targets:
{}

Modules transform: commonjs

Using plugins:
  check-es2015-constants {}
  transform-es2015-arrow-functions {}
  transform-es2015-block-scoped-functions {}
  transform-es2015-block-scoping {}
  transform-es2015-classes {}
  transform-es2015-computed-properties {}
  transform-es2015-destructuring {}
  transform-es2015-duplicate-keys {}
  transform-es2015-for-of {}
  transform-es2015-function-name {}
  transform-es2015-literals {}
  transform-es2015-object-super {}
  transform-es2015-parameters {}
  transform-es2015-shorthand-properties {}
  transform-es2015-spread {}
  transform-es2015-sticky-regex {}
  transform-es2015-template-literals {}
  transform-es2015-typeof-symbol {}
  transform-es2015-unicode-regex {}
  transform-regenerator {}
  transform-exponentiation-operator {}
  transform-async-to-generator {}
  syntax-trailing-function-commas {}
TypeError: src/index.js: Property arguments[0] of CallExpression expected node to be of a type [&quot;Expression&quot;,&quot;SpreadElement&quot;] but instead got undefined
    at validate (node_modules\babel-cli\node_modules\babel-types\lib\definitions\index.js:109:13)
    at validator (node_modules\babel-cli\node_modules\babel-types\lib\definitions\index.js:57:7)
    at Object.validate (node_modules\babel-cli\node_modules\babel-types\lib\definitions\index.js:190:10)
    at validate (node_modules\babel-cli\node_modules\babel-types\lib\index.js:505:9)
    at Object.builder (node_modules\babel-cli\node_modules\babel-types\lib\index.js:466:7)
    at createObjectSpread (C:\Tools\projects\em2\backpack-test\node_modules\babel-plugin-transform-object-rest-spread\lib\index.js:70:38)
    at PluginPass.AssignmentExpression (C:\Tools\projects\em2\backpack-test\node_modules\babel-plugin-transform-object-rest-spread\lib\index.js:186:38)
    at newFn (node_modules\babel-cli\node_modules\babel-traverse\lib\visitors.js:276:21)
    at NodePath._call (node_modules\babel-cli\node_modules\babel-traverse\lib\path\context.js:76:18)
    at NodePath.call (node_modules\babel-cli\node_modules\babel-traverse\lib\path\context.js:48:17)"><pre class="notranslate">$ babel --plugins transform-object-rest-spread src/index.js
babel-preset-env: <span class="pl-s"><span class="pl-pds">`</span>DEBUG<span class="pl-pds">`</span></span> option

Using targets:
{}

Modules transform: commonjs

Using plugins:
  check-es2015-constants {}
  transform-es2015-arrow-functions {}
  transform-es2015-block-scoped-functions {}
  transform-es2015-block-scoping {}
  transform-es2015-classes {}
  transform-es2015-computed-properties {}
  transform-es2015-destructuring {}
  transform-es2015-duplicate-keys {}
  transform-es2015-for-of {}
  transform-es2015-function-name {}
  transform-es2015-literals {}
  transform-es2015-object-super {}
  transform-es2015-parameters {}
  transform-es2015-shorthand-properties {}
  transform-es2015-spread {}
  transform-es2015-sticky-regex {}
  transform-es2015-template-literals {}
  transform-es2015-typeof-symbol {}
  transform-es2015-unicode-regex {}
  transform-regenerator {}
  transform-exponentiation-operator {}
  transform-async-to-generator {}
  syntax-trailing-function-commas {}
TypeError: src/index.js: Property arguments[0] of CallExpression expected node to be of a <span class="pl-c1">type</span> [<span class="pl-s"><span class="pl-pds">"</span>Expression<span class="pl-pds">"</span></span>,<span class="pl-s"><span class="pl-pds">"</span>SpreadElement<span class="pl-pds">"</span></span>] but instead got undefined
    at validate (node_modules<span class="pl-cce">\b</span>abel-cli<span class="pl-cce">\n</span>ode_modules<span class="pl-cce">\b</span>abel-types<span class="pl-cce">\l</span>ib<span class="pl-cce">\d</span>efinitions<span class="pl-cce">\i</span>ndex.js:109:13)
    at validator (node_modules<span class="pl-cce">\b</span>abel-cli<span class="pl-cce">\n</span>ode_modules<span class="pl-cce">\b</span>abel-types<span class="pl-cce">\l</span>ib<span class="pl-cce">\d</span>efinitions<span class="pl-cce">\i</span>ndex.js:57:7)
    at Object.validate (node_modules<span class="pl-cce">\b</span>abel-cli<span class="pl-cce">\n</span>ode_modules<span class="pl-cce">\b</span>abel-types<span class="pl-cce">\l</span>ib<span class="pl-cce">\d</span>efinitions<span class="pl-cce">\i</span>ndex.js:190:10)
    at validate (node_modules<span class="pl-cce">\b</span>abel-cli<span class="pl-cce">\n</span>ode_modules<span class="pl-cce">\b</span>abel-types<span class="pl-cce">\l</span>ib<span class="pl-cce">\i</span>ndex.js:505:9)
    at Object.builder (node_modules<span class="pl-cce">\b</span>abel-cli<span class="pl-cce">\n</span>ode_modules<span class="pl-cce">\b</span>abel-types<span class="pl-cce">\l</span>ib<span class="pl-cce">\i</span>ndex.js:466:7)
    at createObjectSpread (C:<span class="pl-cce">\T</span>ools<span class="pl-cce">\p</span>rojects<span class="pl-cce">\e</span>m2<span class="pl-cce">\b</span>ackpack-test<span class="pl-cce">\n</span>ode_modules<span class="pl-cce">\b</span>abel-plugin-transform-object-rest-spread<span class="pl-cce">\l</span>ib<span class="pl-cce">\i</span>ndex.js:70:38)
    at PluginPass.AssignmentExpression (C:<span class="pl-cce">\T</span>ools<span class="pl-cce">\p</span>rojects<span class="pl-cce">\e</span>m2<span class="pl-cce">\b</span>ackpack-test<span class="pl-cce">\n</span>ode_modules<span class="pl-cce">\b</span>abel-plugin-transform-object-rest-spread<span class="pl-cce">\l</span>ib<span class="pl-cce">\i</span>ndex.js:186:38)
    at newFn (node_modules<span class="pl-cce">\b</span>abel-cli<span class="pl-cce">\n</span>ode_modules<span class="pl-cce">\b</span>abel-traverse<span class="pl-cce">\l</span>ib<span class="pl-cce">\v</span>isitors.js:276:21)
    at NodePath._call (node_modules<span class="pl-cce">\b</span>abel-cli<span class="pl-cce">\n</span>ode_modules<span class="pl-cce">\b</span>abel-traverse<span class="pl-cce">\l</span>ib<span class="pl-cce">\p</span>ath<span class="pl-cce">\c</span>ontext.js:76:18)
    at NodePath.call (node_modules<span class="pl-cce">\b</span>abel-cli<span class="pl-cce">\n</span>ode_modules<span class="pl-cce">\b</span>abel-traverse<span class="pl-cce">\l</span>ib<span class="pl-cce">\p</span>ath<span class="pl-cce">\c</span>ontext.js:48:17)</pre></div>
<h3 dir="auto">Possible Solution</h3>
<p dir="auto">rewrite filtered like this</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="const filtered = fields.reduce((a, c) =&gt; {
  const { [c]: _, ...rest } = a
  return rest
}, user)"><pre class="notranslate"><span class="pl-k">const</span> <span class="pl-s1">filtered</span> <span class="pl-c1">=</span> <span class="pl-s1">fields</span><span class="pl-kos">.</span><span class="pl-en">reduce</span><span class="pl-kos">(</span><span class="pl-kos">(</span><span class="pl-s1">a</span><span class="pl-kos">,</span> <span class="pl-s1">c</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
  <span class="pl-k">const</span> <span class="pl-kos">{</span> <span class="pl-kos">[</span><span class="pl-s1">c</span><span class="pl-kos">]</span>: <span class="pl-s1">_</span><span class="pl-kos">,</span> ...<span class="pl-s1">rest</span> <span class="pl-kos">}</span> <span class="pl-c1">=</span> <span class="pl-s1">a</span>
  <span class="pl-k">return</span> <span class="pl-s1">rest</span>
<span class="pl-kos">}</span><span class="pl-kos">,</span> <span class="pl-s1">user</span><span class="pl-kos">)</span></pre></div>
<h3 dir="auto">Context</h3>
<p dir="auto">I was trying to do code in one line like this</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="(a, c) =&gt; (({ [c]: _, ...rest } = a), rest)"><pre class="notranslate"><span class="pl-kos">(</span><span class="pl-s1">a</span><span class="pl-kos">,</span> <span class="pl-s1">c</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> <span class="pl-kos">[</span><span class="pl-s1">c</span><span class="pl-kos">]</span>: <span class="pl-s1">_</span><span class="pl-kos">,</span> ...<span class="pl-s1">rest</span> <span class="pl-kos">}</span> <span class="pl-c1">=</span> <span class="pl-s1">a</span><span class="pl-kos">)</span><span class="pl-kos">,</span> <span class="pl-s1">rest</span><span class="pl-kos">)</span></pre></div>
<p dir="auto">instead of this:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="(a, c) =&gt; {
  const { [c]: _, ...rest } = a
  return rest
}"><pre class="notranslate"><span class="pl-kos">(</span><span class="pl-s1">a</span><span class="pl-kos">,</span> <span class="pl-s1">c</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
  <span class="pl-k">const</span> <span class="pl-kos">{</span> <span class="pl-kos">[</span><span class="pl-s1">c</span><span class="pl-kos">]</span>: <span class="pl-s1">_</span><span class="pl-kos">,</span> ...<span class="pl-s1">rest</span> <span class="pl-kos">}</span> <span class="pl-c1">=</span> <span class="pl-s1">a</span>
  <span class="pl-k">return</span> <span class="pl-s1">rest</span>
<span class="pl-kos">}</span></pre></div>
<h3 dir="auto">Your Environment</h3>

<table role="table">
<thead>
<tr>
<th>software</th>
<th>version(s)</th>
</tr>
</thead>
<tbody>
<tr>
<td>Babel</td>
<td>6.26.0 (babel-core 6.26.0)</td>
</tr>
<tr>
<td>node</td>
<td>v9.11.1</td>
</tr>
<tr>
<td>npm</td>
<td>5.6.0</td>
</tr>
<tr>
<td>Operating System</td>
<td>Win10</td>
</tr>
</tbody>
</table>