From c37aa705a3ec4b36c9afcc60b7600b7cc8bc309e Mon Sep 17 00:00:00 2001 From: andy-ms Date: Sat, 7 Oct 2017 09:45:23 -0700 Subject: [PATCH] Improve JSDoc @augments diagnostics --- src/compiler/checker.ts | 4 ++-- src/compiler/diagnosticMessages.json | 4 ++-- tests/baselines/reference/jsdocAugments_notAClass.errors.txt | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index a8e18c432a6bb..8863dec5a0dde 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -20017,7 +20017,7 @@ namespace ts { function checkJSDocAugmentsTag(node: JSDocAugmentsTag): void { const cls = getJSDocHost(node); if (!isClassDeclaration(cls) && !isClassExpression(cls)) { - error(cls, Diagnostics.JSDoc_augments_is_not_attached_to_a_class_declaration); + error(cls, Diagnostics.JSDoc_0_is_not_attached_to_a_class, idText(node.tagName)); return; } @@ -20026,7 +20026,7 @@ namespace ts { if (extend) { const className = getIdentifierFromEntityNameExpression(extend.expression); if (className && name.escapedText !== className.escapedText) { - error(name, Diagnostics.JSDoc_augments_0_does_not_match_the_extends_1_clause, idText(name), idText(className)); + error(name, Diagnostics.JSDoc_0_1_does_not_match_the_extends_2_clause, idText(node.tagName), idText(name), idText(className)); } } } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index f3d6d4fcc4706..4e34affcff953 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3515,11 +3515,11 @@ "category": "Error", "code": 8021 }, - "JSDoc '@augments' is not attached to a class declaration.": { + "JSDoc '@{0}' is not attached to a class.": { "category": "Error", "code": 8022 }, - "JSDoc '@augments {0}' does not match the 'extends {1}' clause.": { + "JSDoc '@{0} {1}' does not match the 'extends {2}' clause.": { "category": "Error", "code": 8023 }, diff --git a/tests/baselines/reference/jsdocAugments_notAClass.errors.txt b/tests/baselines/reference/jsdocAugments_notAClass.errors.txt index 9f8528f0cd804..daf20aaf884b1 100644 --- a/tests/baselines/reference/jsdocAugments_notAClass.errors.txt +++ b/tests/baselines/reference/jsdocAugments_notAClass.errors.txt @@ -1,4 +1,4 @@ -/b.js(3,10): error TS8022: JSDoc '@augments' is not attached to a class declaration. +/b.js(3,10): error TS8022: JSDoc '@augments' is not attached to a class. ==== /b.js (1 errors) ==== @@ -6,5 +6,5 @@ /** @augments A */ function b() {} ~ -!!! error TS8022: JSDoc '@augments' is not attached to a class declaration. +!!! error TS8022: JSDoc '@augments' is not attached to a class. \ No newline at end of file