Improve error messages for computed class property names (#42675)

This commit is contained in:
ZYSzys
2021-02-19 07:58:18 +08:00
committed by GitHub
parent a2ed469022
commit 9950b6e596
25 changed files with 176 additions and 176 deletions

View File

@@ -40782,7 +40782,7 @@ namespace ts {
if (isStringLiteral(node.name) && node.name.text === "constructor") {
return grammarErrorOnNode(node.name, Diagnostics.Classes_may_not_have_a_field_named_constructor);
}
if (checkGrammarForInvalidDynamicName(node.name, Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) {
if (checkGrammarForInvalidDynamicName(node.name, Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_have_a_simple_literal_type_or_a_unique_symbol_type)) {
return true;
}
if (languageVersion < ScriptTarget.ES2015 && isPrivateIdentifier(node.name)) {

View File

@@ -503,7 +503,7 @@
"category": "Error",
"code": 1165
},
"A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type.": {
"A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.": {
"category": "Error",
"code": 1166
},