Disallow Infinity, -Infinity and NaN as an enum key name (#56161)

This commit is contained in:
magic-akari
2023-12-07 07:30:06 +08:00
committed by GitHub
parent 7e1c297730
commit ecc10241c8
4 changed files with 31 additions and 1 deletions

View File

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