|
| 1 | +//// [objectRestSpread.ts] |
| 2 | +let obj = {}; |
| 3 | + |
| 4 | +({...obj}); |
| 5 | +let { |
| 6 | + prop = { ...obj }, |
| 7 | + more = { ...obj } = { ...obj }, |
| 8 | + ['' + 'other']: other = { ...obj }, |
| 9 | + yetAnother: {nested: { ['nested' + 'prop']: nestedProp = { ...obj }, ...nestedRest } = { ...obj }} = { ...obj }, |
| 10 | + fn = async function*() {}, |
| 11 | + ...props |
| 12 | +} = {} as any; |
| 13 | + |
| 14 | +({ |
| 15 | + prop = { ...obj }, |
| 16 | + ['' + 'other']: other = { ...obj }, |
| 17 | + ...props |
| 18 | +} = {} as any) |
| 19 | + |
| 20 | +function test({ |
| 21 | + prop = { ...obj }, |
| 22 | + ...props |
| 23 | +}) {} |
| 24 | + |
| 25 | +//// [objectRestSpread.js] |
| 26 | +var __rest = (this && this.__rest) || function (s, e) { |
| 27 | + var t = {}; |
| 28 | + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) |
| 29 | + t[p] = s[p]; |
| 30 | + if (s != null && typeof Object.getOwnPropertySymbols === "function") |
| 31 | + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { |
| 32 | + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) |
| 33 | + t[p[i]] = s[p[i]]; |
| 34 | + } |
| 35 | + return t; |
| 36 | +}; |
| 37 | +var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } |
| 38 | +var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) { |
| 39 | + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); |
| 40 | + var g = generator.apply(thisArg, _arguments || []), i, q = []; |
| 41 | + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; |
| 42 | + function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } |
| 43 | + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } |
| 44 | + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } |
| 45 | + function fulfill(value) { resume("next", value); } |
| 46 | + function reject(value) { resume("throw", value); } |
| 47 | + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } |
| 48 | +}; |
| 49 | +var _a, _b, _c, _d; |
| 50 | +let obj = {}; |
| 51 | +(Object.assign({}, obj)); |
| 52 | +let _e = {}, { prop = Object.assign({}, obj), more = _a = Object.assign({}, obj), obj = __rest(_a, []), _a } = _e, _f = '' + 'other', _g = _e[_f], other = _g === void 0 ? Object.assign({}, obj) : _g, _h = _e.yetAnother, _j = (_h === void 0 ? Object.assign({}, obj) : _h).nested, _k = _j === void 0 ? Object.assign({}, obj) : _j, _l = 'nested' + 'prop', _m = _k[_l], nestedProp = _m === void 0 ? Object.assign({}, obj) : _m, nestedRest = __rest(_k, [typeof _l === "symbol" ? _l : _l + ""]), { fn = function () { return __asyncGenerator(this, arguments, function* () { }); } } = _e, props = __rest(_e, ["prop", "more", typeof _f === "symbol" ? _f : _f + "", "yetAnother", "fn"]); |
| 53 | +(_b = {}, { prop = Object.assign({}, obj) } = _b, _c = '' + 'other', _d = _b[_c], other = _d === void 0 ? Object.assign({}, obj) : _d, props = __rest(_b, ["prop", typeof _c === "symbol" ? _c : _c + ""])); |
| 54 | +function test(_a) { var { prop = Object.assign({}, obj) } = _a, props = __rest(_a, ["prop"]); } |
0 commit comments