From 15b0fef977bf75a3bfe8d86f2aa2583331dbb671 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Wed, 14 Mar 2018 11:18:05 -0700 Subject: [PATCH 1/2] Improve unmatched jsdoc parameter error message --- src/compiler/checker.ts | 2 +- src/compiler/diagnosticMessages.json | 4 ++-- .../reference/paramTagOnFunctionUsingArguments.errors.txt | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 0e023fc2ac5b9..9c25ba4aee683 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -21457,7 +21457,7 @@ namespace ts { node.typeExpression && node.typeExpression.type && !isArrayType(getTypeFromTypeNode(node.typeExpression.type))) { error(node.name, - Diagnostics.The_last_param_tag_of_a_function_that_uses_arguments_must_have_an_array_type, + 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, idText(node.name.kind === SyntaxKind.QualifiedName ? node.name.right : node.name)); } } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index d0e97d188a316..70f136c7e2cf2 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1943,7 +1943,7 @@ "Expected {0} arguments, but got {1} or more.": { "category": "Error", "code": 2556 - }, + }, "Expected at least {0} arguments, but got {1} or more.": { "category": "Error", "code": 2557 @@ -3720,7 +3720,7 @@ "category": "Error", "code": 8028 }, - "The last @param tag of a function that uses 'arguments' must have an array type.": { + "JSDoc '@param' tag has name '{0}', but there is no parameter with that name. It would match 'arguments' if it had an array type.": { "category": "Error", "code": 8029 }, diff --git a/tests/baselines/reference/paramTagOnFunctionUsingArguments.errors.txt b/tests/baselines/reference/paramTagOnFunctionUsingArguments.errors.txt index f9ad715c49b66..bcbeb125338ce 100644 --- a/tests/baselines/reference/paramTagOnFunctionUsingArguments.errors.txt +++ b/tests/baselines/reference/paramTagOnFunctionUsingArguments.errors.txt @@ -1,4 +1,4 @@ -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. +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. tests/cases/conformance/jsdoc/a.js(19,9): error TS2345: Argument of type '1' is not assignable to parameter of type 'string'. @@ -8,7 +8,7 @@ tests/cases/conformance/jsdoc/a.js(19,9): error TS2345: Argument of type '1' is /** * @param {string} first ~~~~~ -!!! error TS8029: The last @param tag of a function that uses 'arguments' must have an array type. +!!! 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. */ function concat(/* first, second, ... */) { var s = '' From a8a041c9c8ae110fb1e37aa75f27a588fa30a576 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Wed, 14 Mar 2018 11:19:07 -0700 Subject: [PATCH 2/2] Remove extraneous carriage return --- src/compiler/diagnosticMessages.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 70f136c7e2cf2..f4f7587b78ac9 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1943,7 +1943,7 @@ "Expected {0} arguments, but got {1} or more.": { "category": "Error", "code": 2556 - }, + }, "Expected at least {0} arguments, but got {1} or more.": { "category": "Error", "code": 2557