mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Allow -Infinity as an enum property name
This commit is contained in:
@@ -10034,7 +10034,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function isInfinityOrNaNString(name: string) : boolean {
|
||||
return name === 'Infinity' || name === 'NaN';
|
||||
return name === 'Infinity' || name === '-Infinity' || name === 'NaN';
|
||||
}
|
||||
|
||||
function isNumericLiteralName(name: string) {
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
//// [enumWithNegativeInfinityProperty.ts]
|
||||
enum A {
|
||||
"-Infinity" = 1
|
||||
}
|
||||
|
||||
|
||||
//// [enumWithNegativeInfinityProperty.js]
|
||||
var A;
|
||||
(function (A) {
|
||||
A[A["-Infinity"] = 1] = "-Infinity";
|
||||
})(A || (A = {}));
|
||||
@@ -0,0 +1,7 @@
|
||||
=== tests/cases/compiler/enumWithNegativeInfinityProperty.ts ===
|
||||
enum A {
|
||||
>A : Symbol(A, Decl(enumWithNegativeInfinityProperty.ts, 0, 0))
|
||||
|
||||
"-Infinity" = 1
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
=== tests/cases/compiler/enumWithNegativeInfinityProperty.ts ===
|
||||
enum A {
|
||||
>A : A
|
||||
|
||||
"-Infinity" = 1
|
||||
>1 : number
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
enum A {
|
||||
"-Infinity" = 1
|
||||
}
|
||||
Reference in New Issue
Block a user