Skip to content

Commit 0f51665

Browse files
committed
Improve unmatched jsdoc param error (#22577)
* Improve unmatched jsdoc parameter error message * Remove extraneous carriage return
1 parent ee8adae commit 0f51665

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21476,7 +21476,7 @@ namespace ts {
2147621476
node.typeExpression && node.typeExpression.type &&
2147721477
!isArrayType(getTypeFromTypeNode(node.typeExpression.type))) {
2147821478
error(node.name,
21479-
Diagnostics.The_last_param_tag_of_a_function_that_uses_arguments_must_have_an_array_type,
21479+
Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_had_an_array_type,
2148021480
idText(node.name.kind === SyntaxKind.QualifiedName ? node.name.right : node.name));
2148121481
}
2148221482
}

src/compiler/diagnosticMessages.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3720,7 +3720,7 @@
37203720
"category": "Error",
37213721
"code": 8028
37223722
},
3723-
"The last @param tag of a function that uses 'arguments' must have an array type.": {
3723+
"JSDoc '@param' tag has name '{0}', but there is no parameter with that name. It would match 'arguments' if it had an array type.": {
37243724
"category": "Error",
37253725
"code": 8029
37263726
},

tests/baselines/reference/paramTagOnFunctionUsingArguments.errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
tests/cases/conformance/jsdoc/a.js(2,20): error TS8029: The last @param tag of a function that uses 'arguments' must have an array type.
1+
tests/cases/conformance/jsdoc/a.js(2,20): error TS8029: JSDoc '@param' tag has name 'first', but there is no parameter with that name. It would match 'arguments' if it had an array type.
22
tests/cases/conformance/jsdoc/a.js(19,9): error TS2345: Argument of type '1' is not assignable to parameter of type 'string'.
33

44

@@ -8,7 +8,7 @@ tests/cases/conformance/jsdoc/a.js(19,9): error TS2345: Argument of type '1' is
88
/**
99
* @param {string} first
1010
~~~~~
11-
!!! error TS8029: The last @param tag of a function that uses 'arguments' must have an array type.
11+
!!! error TS8029: JSDoc '@param' tag has name 'first', but there is no parameter with that name. It would match 'arguments' if it had an array type.
1212
*/
1313
function concat(/* first, second, ... */) {
1414
var s = ''

0 commit comments

Comments
 (0)