Closed
Description
Using the release-2.1
branch, with target: "es6"
, this code:
const init = {a: 10, b: true};
let newObj = {...init, c: null};
Generates the below emit, which contains the unnecessary helper __assign
, as Object.assign
is part of ES6 (see http://www.ecma-international.org/ecma-262/6.0/#sec-object.assign ).
var __assign = (this && this.__assign) || Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
const init = { a: 10, b: true };
let newObj = __assign({}, init, { c: null });