diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 3910d658edf..e2377db8f31 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -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) { diff --git a/tests/baselines/reference/enumWithNegativeInfinityProperty.js b/tests/baselines/reference/enumWithNegativeInfinityProperty.js new file mode 100644 index 00000000000..867545fb14a --- /dev/null +++ b/tests/baselines/reference/enumWithNegativeInfinityProperty.js @@ -0,0 +1,11 @@ +//// [enumWithNegativeInfinityProperty.ts] +enum A { + "-Infinity" = 1 +} + + +//// [enumWithNegativeInfinityProperty.js] +var A; +(function (A) { + A[A["-Infinity"] = 1] = "-Infinity"; +})(A || (A = {})); diff --git a/tests/baselines/reference/enumWithNegativeInfinityProperty.symbols b/tests/baselines/reference/enumWithNegativeInfinityProperty.symbols new file mode 100644 index 00000000000..51c61196ca6 --- /dev/null +++ b/tests/baselines/reference/enumWithNegativeInfinityProperty.symbols @@ -0,0 +1,7 @@ +=== tests/cases/compiler/enumWithNegativeInfinityProperty.ts === +enum A { +>A : Symbol(A, Decl(enumWithNegativeInfinityProperty.ts, 0, 0)) + + "-Infinity" = 1 +} + diff --git a/tests/baselines/reference/enumWithNegativeInfinityProperty.types b/tests/baselines/reference/enumWithNegativeInfinityProperty.types new file mode 100644 index 00000000000..bc09333075d --- /dev/null +++ b/tests/baselines/reference/enumWithNegativeInfinityProperty.types @@ -0,0 +1,8 @@ +=== tests/cases/compiler/enumWithNegativeInfinityProperty.ts === +enum A { +>A : A + + "-Infinity" = 1 +>1 : number +} + diff --git a/tests/cases/compiler/enumWithNegativeInfinityProperty.ts b/tests/cases/compiler/enumWithNegativeInfinityProperty.ts new file mode 100644 index 00000000000..057c3a5e669 --- /dev/null +++ b/tests/cases/compiler/enumWithNegativeInfinityProperty.ts @@ -0,0 +1,3 @@ +enum A { + "-Infinity" = 1 +}