-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Labels
Spec: Object Rest/SpreadoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue
Description
💻
- Would you like to work on a fix?
How are you using Babel?
Programmatic API (babel.transform, babel.parse)
Input code
let rest;
([{ ...rest }] = [{}])
for ([{ ...rest }] of [[{}]]);Configuration file name
No response
Configuration
{
"plugins": ["@babel/plugin-transform-object-rest-spread"]
}Current and expected behavior
Current: The generated code throws redeclaration error because rest is defined as let and then redeclared with var
// helper code omitted
let rest;
[_ref] = [{}];
var rest = _extends({}, (_objectDestructuringEmpty(_ref), _ref));Expected: This is valid JS, the transpiled code should not throw. rest should be defined and initialized as an empty object.
Environment
REPL
Possible solution
No response
Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Spec: Object Rest/SpreadoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue