Revert PR 56161 (#57853)

This commit is contained in:
Jake Bailey
2024-03-19 15:07:33 -07:00
committed by GitHub
parent cc460dc327
commit 309fd3db81
4 changed files with 1 additions and 31 deletions

View File

@@ -45689,7 +45689,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
}
else {
const text = getTextOfPropertyName(member.name);
if (isNumericLiteralName(text)) {
if (isNumericLiteralName(text) && !isInfinityOrNaNString(text)) {
error(member.name, Diagnostics.An_enum_member_cannot_have_a_numeric_name);
}
}

View File

@@ -1,10 +0,0 @@
enumWithInfinityProperty.ts(2,5): error TS2452: An enum member cannot have a numeric name.
==== enumWithInfinityProperty.ts (1 errors) ====
enum A {
Infinity = 1
~~~~~~~~
!!! error TS2452: An enum member cannot have a numeric name.
}

View File

@@ -1,10 +0,0 @@
enumWithNaNProperty.ts(2,5): error TS2452: An enum member cannot have a numeric name.
==== enumWithNaNProperty.ts (1 errors) ====
enum A {
NaN = 1
~~~
!!! error TS2452: An enum member cannot have a numeric name.
}

View File

@@ -1,10 +0,0 @@
enumWithNegativeInfinityProperty.ts(2,5): error TS2452: An enum member cannot have a numeric name.
==== enumWithNegativeInfinityProperty.ts (1 errors) ====
enum A {
"-Infinity" = 1
~~~~~~~~~~~
!!! error TS2452: An enum member cannot have a numeric name.
}