Skip to content

Commit b839e17

Browse files
author
Andy
authored
Improve JSDoc @Augments diagnostics (#19011)
1 parent 9ccc1b4 commit b839e17

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20034,7 +20034,7 @@ namespace ts {
2003420034
function checkJSDocAugmentsTag(node: JSDocAugmentsTag): void {
2003520035
const classLike = getJSDocHost(node);
2003620036
if (!isClassDeclaration(classLike) && !isClassExpression(classLike)) {
20037-
error(classLike, Diagnostics.JSDoc_augments_is_not_attached_to_a_class_declaration);
20037+
error(classLike, Diagnostics.JSDoc_0_is_not_attached_to_a_class, idText(node.tagName));
2003820038
return;
2003920039
}
2004020040

@@ -20049,7 +20049,7 @@ namespace ts {
2004920049
if (extend) {
2005020050
const className = getIdentifierFromEntityNameExpression(extend.expression);
2005120051
if (className && name.escapedText !== className.escapedText) {
20052-
error(name, Diagnostics.JSDoc_augments_0_does_not_match_the_extends_1_clause, idText(name), idText(className));
20052+
error(name, Diagnostics.JSDoc_0_1_does_not_match_the_extends_2_clause, idText(node.tagName), idText(name), idText(className));
2005320053
}
2005420054
}
2005520055
}

src/compiler/diagnosticMessages.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3519,11 +3519,11 @@
35193519
"category": "Error",
35203520
"code": 8021
35213521
},
3522-
"JSDoc '@augments' is not attached to a class declaration.": {
3522+
"JSDoc '@{0}' is not attached to a class.": {
35233523
"category": "Error",
35243524
"code": 8022
35253525
},
3526-
"JSDoc '@augments {0}' does not match the 'extends {1}' clause.": {
3526+
"JSDoc '@{0} {1}' does not match the 'extends {2}' clause.": {
35273527
"category": "Error",
35283528
"code": 8023
35293529
},
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
/b.js(3,10): error TS8022: JSDoc '@augments' is not attached to a class declaration.
1+
/b.js(3,10): error TS8022: JSDoc '@augments' is not attached to a class.
22

33

44
==== /b.js (1 errors) ====
55
class A {}
66
/** @augments A */
77
function b() {}
88
~
9-
!!! error TS8022: JSDoc '@augments' is not attached to a class declaration.
9+
!!! error TS8022: JSDoc '@augments' is not attached to a class.
1010

0 commit comments

Comments
 (0)