mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-29 16:29:19 -05:00
Improve error messages for computed class property names (#42675)
This commit is contained in:
@@ -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)) {
|
||||
|
||||
@@ -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
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user