mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-11-18 20:11:14 +00:00
fix(39373): add diagnostic message about using a private name for class declarations without name (#39567)
This commit is contained in:
1 parent
1d671c3588
commit
4e24b1b00d
7 files changed
+100
-2
No files matched your search
@@ -3057,6 +3057,10 @@
|
||||
"category": "Error",
|
||||
"code": 4020
|
||||
},
|
||||
"'extends' clause of exported class has or is using private name '{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 4021
|
||||
},
|
||||
"'extends' clause of exported interface '{0}' has or is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 4022
|
||||
|
||||
@@ -447,11 +447,12 @@ namespace ts {
|
||||
function getHeritageClauseVisibilityError(): SymbolAccessibilityDiagnostic {
|
||||
let diagnosticMessage: DiagnosticMessage;
|
||||
// Heritage clause is written by user so it can always be named
|
||||
if (node.parent.parent.kind === SyntaxKind.ClassDeclaration) {
|
||||
if (isClassDeclaration(node.parent.parent)) {
|
||||
// Class or Interface implemented/extended is inaccessible
|
||||
diagnosticMessage = isHeritageClause(node.parent) && node.parent.token === SyntaxKind.ImplementsKeyword ?
|
||||
Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 :
|
||||
Diagnostics.extends_clause_of_exported_class_0_has_or_is_using_private_name_1;
|
||||
node.parent.parent.name ? Diagnostics.extends_clause_of_exported_class_0_has_or_is_using_private_name_1 :
|
||||
Diagnostics.extends_clause_of_exported_class_has_or_is_using_private_name_0;
|
||||
}
|
||||
else {
|
||||
// interface is inaccessible
|
||||
|
||||
Reference in new issue
Block a user