mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-23 07:07:09 -05:00
Fix declaration emit for negative number property declarations
This commit is contained in:
@@ -4652,6 +4652,9 @@ namespace ts {
|
||||
if (!isIdentifierText(name, compilerOptions.target) && !isNumericLiteralName(name)) {
|
||||
return `"${escapeString(name, CharacterCodes.doubleQuote)}"`;
|
||||
}
|
||||
if (isNumericLiteralName(name) && startsWith(name, "-")) {
|
||||
return `[${name}]`;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
if (nameType.flags & TypeFlags.UniqueESSymbol) {
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
// @target: es5
|
||||
// @declaration: true
|
||||
var v = {
|
||||
[-1]: {}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// @target: es6
|
||||
// @declaration: true
|
||||
var v = {
|
||||
[-1]: {}
|
||||
}
|
||||
Reference in New Issue
Block a user