Repository navigation
fix(computed-properties): keep object spread elements - #18581
Conversation
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/63354 |
|
commit: |
|
I would prefer the "throw an helpful error" approach, as I cannot imagine why one would want to use the computed properties plugin without also using the spread plugin. |
When an object literal had both a computed key and a spread element, and object rest/spread was not transformed, the spread element was dropped from the output. Spread elements before the first computed key now stay in the initial object literal. Those after it are applied in source order with the objectSpread2 helper, so that they still override the properties defined before them. Fixes #16233 Closes #17150 Assisted-by: Claude Fable 5.2
a2a9966 to
693c995
Compare
@JLHwung Has this review been addressed? |
Throw an error instead of compiling spread elements that follow a computed key. Spread elements before the first computed key still stay in the initial object literal. Assisted-by: Claude Opus 5.5
OK, I pushed a new commit that just throws an error when we have seen spread after the computed properties, the spread before computed properties still passes through. |
|
Backported to 7.x in #18642. |
In this PR we preserve the object spread element before the first computed key, and throw an error if the spread element and seen after the first computed key, which this plugin can not handled.
Assisted-by: Claude Fable 5.2