diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 2351f6913af..5c69bb7f356 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -10182,10 +10182,10 @@ namespace ts { // A private or protected constructor can only be instantiated within it's own class if (declaringClass !== enclosingClass) { if (flags & NodeFlags.Private) { - error(node, Diagnostics.Constructor_of_type_0_is_private_and_only_accessible_within_class_1, signatureToString(signature), typeToString(declaringClass)); + error(node, Diagnostics.Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration, typeToString(declaringClass)); } if (flags & NodeFlags.Protected) { - error(node, Diagnostics.Constructor_of_type_0_is_protected_and_only_accessible_within_class_1, signatureToString(signature), typeToString(declaringClass)); + error(node, Diagnostics.Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration, typeToString(declaringClass)); } return false; } @@ -14059,7 +14059,7 @@ namespace ts { if (signatures.length) { const declaration = signatures[0].declaration; if (declaration && declaration.flags & NodeFlags.Private) { - error(node, Diagnostics.Cannot_extend_private_class_0, (node.expression).text); + error(node, Diagnostics.Cannot_extend_a_class_0_Class_constructor_is_marked_as_private, (node.expression).text); } } } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 2ee388ff42e..b88b9b2a0e1 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1827,15 +1827,15 @@ "category": "Error", "code": 2672 }, - "Constructor of type '{0}' is private and only accessible within class '{1}'.": { + "Constructor of class '{0}' is private and only accessible within the class declaration.": { "category": "Error", "code": 2673 }, - "Constructor of type '{0}' is protected and only accessible within class '{1}'.": { + "Constructor of class '{0}' is protected and only accessible within the class declaration.": { "category": "Error", "code": 2674 }, - "Cannot extend private class '{0}'.": { + "Cannot extend a class '{0}'. Class constructor is marked as private.": { "category": "Error", "code": 2675 },