transform-object-rest-spread does not follow complete spec, should use CreateDataProperty instead of Set (T7461) #4371
Labels
outdated
A closed issue/PR that is archived due to age. Recommended to make a new issue
PR: Spec Compliance 👓
A type of pull request used for our changelog categories
Spec: Object Rest/Spread
Bug information
Options
Input code
Description
The spec for Object spread explicitly states that
CreateDataProperty
should be used instead ofSet
. Currently, the spread transform usesObject.assign
, which usesSet
.This will cause instances where setters that exist on the target object will be triggered, even though that behavior is counter to spec. In cases where a setter is not detected within the surrounding object literal,
_extends
can be used. However, if a setter is detected, then a different function usingObject.defineProperties
should be used.Alternatively, it could be specified that this transform does not fully comply with the specification, and setters within object literals should be avoided with this syntax.
The text was updated successfully, but these errors were encountered: