mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-06 02:33:53 -06:00
Improve rest/spread emit for symbols
Previously, symbols were not handled.
This commit is contained in:
parent
b9fa06f90b
commit
47f331926e
@ -38,6 +38,9 @@ var __assign = (this && this.__assign) || Object.assign || function(t) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
if (typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, s = Object.getOwnPropertySymbols(s); i < s.length; i++)
|
||||
t[i] = s[i];
|
||||
}
|
||||
return t;
|
||||
};`;
|
||||
@ -47,6 +50,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
if (typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, s = Object.getOwnPropertySymbols(s); i < s.length; i++) if (e.indexOf(s[i]) > 0)
|
||||
t[i] = s[i];
|
||||
return t;
|
||||
};`;
|
||||
|
||||
|
||||
@ -428,7 +428,14 @@ namespace ts {
|
||||
}
|
||||
if (isComputedPropertyName(getPropertyName(element))) {
|
||||
// get the temp name and put that in there instead, like `_tmp + ""`
|
||||
propertyNames.push(createBinary(computedTempVariables.shift(), SyntaxKind.PlusToken, createLiteral("")));
|
||||
const temp = computedTempVariables.shift();
|
||||
propertyNames.push(createConditional(createBinary(createTypeOf(temp),
|
||||
SyntaxKind.EqualsEqualsEqualsToken,
|
||||
createLiteral("symbol")),
|
||||
createToken(SyntaxKind.QuestionToken),
|
||||
temp,
|
||||
createToken(SyntaxKind.ColonToken),
|
||||
createBinary(temp, SyntaxKind.PlusToken, createLiteral(""))));
|
||||
}
|
||||
else {
|
||||
const propName = getTextOfPropertyName(getPropertyName(element));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user