Open HerringtonDarkholme opened 7 years ago
Is this a curious issue of spec compliance, or a real-world thing?
Purely compliance issue, I haven't seen any real world problem. Not even in Babel's issue list.
It's not just a question of spec compliance. First of all, Babel implements this behavior so people migrating from Babel to TypeScript may introduce bugs into their codebases. Secondly, this is important for some security-enhanced environments as it's possible to monkey-patch methods like Object.assign
but not syntax like object spread. See the meeting notes of TC39 regarding this decision: https://tc39.github.io/tc39-notes/2014-09_sept-25.html#58-object-rest-destructuring-and-spread-properties
@RyanCavanaugh based on some of your more recent comments I think you are not actively interested in issues like this. Perhaps this one can be closed?
Current stage-3 spec requires object spread should define new properties on rest object, not set value on rest object.
Spec: http://sebmarkbage.github.io/ecmascript-rest-spread/#AbstractOperations-CopyDataProperties More readable example: https://github.com/sebmarkbage/ecmascript-rest-spread/blob/master/Issues.md#setters
TypeScript Version: nightly
Code
Expected behavior: No runtime error.
Actual behavior: Runtime error.
Note: Babel does not define properties by default either.