Skip to content

Object-rest-spread doesn't work in case of destructuring with default object parameter #4851

@klimashkin

Description

@klimashkin

With latest transform-object-rest-spread 6.19.0 and without transform-es2015-destructuring, transform-es2015-parameters, such code:

function fn({a = 1, ...b} = {}) {
  return {a, b};
}

remains the same after transformation

function fn({a = 1, ...b} = {}) {
  return {a, b};
}

Without default object = {} it is transformed as expected to

function fn(_ref) {
  let { a = 1 } = _ref;
  let b = (0, _objectWithoutProperties3.default)(_ref, ["a"]);

  return { a, b };
}
}

Babel Configuration (.babelrc)

{
  plugins: [
     ['transform-object-rest-spread', {useBuiltIns: true}]
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    outdatedA 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