mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-04-16 16:02:43 -05:00
Improve error message for unserializable private and protected class members (#59229)
This commit is contained in:
@@ -4212,7 +4212,7 @@
|
||||
"category": "Error",
|
||||
"code": 4092
|
||||
},
|
||||
"Property '{0}' of exported class expression may not be private or protected.": {
|
||||
"Property '{0}' of exported anonymous class type may not be private or protected.": {
|
||||
"category": "Error",
|
||||
"code": 4094
|
||||
},
|
||||
|
||||
@@ -357,7 +357,10 @@ export function transformDeclarations(context: TransformationContext) {
|
||||
function reportPrivateInBaseOfClassExpression(propertyName: string) {
|
||||
if (errorNameNode || errorFallbackNode) {
|
||||
context.addDiagnostic(
|
||||
createDiagnosticForNode((errorNameNode || errorFallbackNode)!, Diagnostics.Property_0_of_exported_class_expression_may_not_be_private_or_protected, propertyName),
|
||||
addRelatedInfo(
|
||||
createDiagnosticForNode((errorNameNode || errorFallbackNode)!, Diagnostics.Property_0_of_exported_anonymous_class_type_may_not_be_private_or_protected, propertyName),
|
||||
...(isVariableDeclaration((errorNameNode || errorFallbackNode)!.parent) ? [createDiagnosticForNode((errorNameNode || errorFallbackNode)!, Diagnostics.Add_a_type_annotation_to_the_variable_0, errorDeclarationNameWithFallback())] : []),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user