Skip to content

[@babel/plugin-proposal-object-rest-spread] TypeError: Cannot read property 'references' of undefined #10339

@mvila

Description

@mvila

Bug Report

Current Behavior

While transpiling some code involving object destructuring, the following error is thrown:

TypeError: Cannot read property 'references' of undefined
    at Object.keys.forEach.bindingName (.../node_modules/@babel/plugin-proposal-object-rest-spread/lib/index.js:146:45)

Input Code

function test(documents) {
  for (const {id, ...fields} of documents) {
    const func = () => {
      console.log(id);
    };

    func();
    console.log(fields);
  }
}

Expected behavior/code

@babel/plugin-proposal-object-rest-spread shouldn't throw an error.

Babel Configuration

Env preset browsers: 'safari 10' (see REPL link above)

Environment

  • Babel v7.5.5 running in the official REPL (see REPL link above)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Spec: Object Rest/SpreadoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions