Skip to content
Permalink
Browse files
fix(51112): omit parameter names that precede the type (#51142)
  • Loading branch information
a-tarasyuk committed Oct 13, 2022
1 parent cf1b6b7 commit 2da62a784bbba237b8239e84c8629cfafb0f595e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
@@ -40136,7 +40136,7 @@ namespace ts {
}
}
else {
forEach(jsdocParameters, ({ name }, index) => {
forEach(jsdocParameters, ({ name, isNameFirst }, index) => {
if (excludedParameters.has(index) || isIdentifier(name) && parameters.has(name.escapedText)) {
return;
}
@@ -40146,7 +40146,9 @@ namespace ts {
}
}
else {
errorOrSuggestion(isJs, name, Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, idText(name));
if (!isNameFirst) {
errorOrSuggestion(isJs, name, Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, idText(name));
}
}
});
}
@@ -1,10 +1,9 @@
tests/cases/conformance/jsdoc/0.js(56,20): error TS8024: JSDoc '@param' tag has name 'obj', but there is no parameter with that name.
tests/cases/conformance/jsdoc/0.js(61,19): error TS2339: Property 'a' does not exist on type 'String'.
tests/cases/conformance/jsdoc/0.js(61,22): error TS2339: Property 'b' does not exist on type 'String'.
tests/cases/conformance/jsdoc/0.js(63,20): error TS8024: JSDoc '@param' tag has name 'y', but there is no parameter with that name.


==== tests/cases/conformance/jsdoc/0.js (4 errors) ====
==== tests/cases/conformance/jsdoc/0.js (3 errors) ====
// Object literal syntax
/**
* @param {{a: string, b: string}} obj
@@ -61,8 +60,6 @@ tests/cases/conformance/jsdoc/0.js(63,20): error TS8024: JSDoc '@param' tag has

/**
* @param {object} obj - this type gets ignored
~~~
!!! error TS8024: JSDoc '@param' tag has name 'obj', but there is no parameter with that name.
* @param {string} obj.a
* @param {string} obj.b - and x's type gets used for both parameters
* @param {string} x
@@ -1,5 +1,4 @@
tests/cases/conformance/jsdoc/bad.js(2,11): error TS1003: Identifier expected.
tests/cases/conformance/jsdoc/bad.js(2,11): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name.
tests/cases/conformance/jsdoc/bad.js(5,4): error TS1003: Identifier expected.
tests/cases/conformance/jsdoc/bad.js(5,4): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name.
tests/cases/conformance/jsdoc/bad.js(6,20): error TS1003: Identifier expected.
@@ -24,13 +23,11 @@ tests/cases/conformance/jsdoc/bad.js(9,20): error TS7006: Parameter 'z' implicit
good(1, 2, 3)


==== tests/cases/conformance/jsdoc/bad.js (9 errors) ====
==== tests/cases/conformance/jsdoc/bad.js (8 errors) ====
/**
* @param *

!!! error TS1003: Identifier expected.

!!! error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name.
* {number} x Arg x.
* @param {number}
* * y Arg y.

0 comments on commit 2da62a7

Please sign in to comment.