💻
What problem are you trying to solve?
Destructuring Private proposal just reached Stage 2. Babel should support parsing as well as transforming this feature.
Describe the solution you'd like
For parsing, we can add a new parser plugin DestructuringPrivate and extend parseObjectProperty to cover new syntax.
For transforming, we should only transform the private destructuring. For example,
// In
const { #x: x, y = x, #z: { #w: w, ...v } } = o;
// Out
const x = o.#x;
const { y = x } = o;
const o$z = o.#z;
const w = o$z.#w;
const { ...v } = o$z; // private fields are not enumerable and thus `v` should not contain `#z`
Describe alternatives you've considered
For transforming, we can also run the full destructuring transform, but the output will be more verbose.
Documentation, Adoption, Migration Strategy
No response
💻
What problem are you trying to solve?
Destructuring Private proposal just reached Stage 2. Babel should support parsing as well as transforming this feature.
Describe the solution you'd like
For parsing, we can add a new parser plugin
DestructuringPrivateand extendparseObjectPropertyto cover new syntax.For transforming, we should only transform the private destructuring. For example,
Describe alternatives you've considered
For transforming, we can also run the full destructuring transform, but the output will be more verbose.
Documentation, Adoption, Migration Strategy
No response