Skip to content

Commit c970c78

Browse files
committed
Add parameter type in function support comments for JS files
1 parent d537b79 commit c970c78

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/services/jsDoc.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @internal */
1+
/* @internal */
22
namespace ts.JsDoc {
33
const jsDocTagNames = [
44
"augments",
@@ -168,13 +168,18 @@ namespace ts.JsDoc {
168168
const indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character);
169169

170170
let docParams = "";
171+
let isJavaScriptFile = hasJavaScriptFileExtension(sourceFile.fileName); // JSX or JS file
171172
for (let i = 0, numParams = parameters.length; i < numParams; i++) {
172173
const currentName = parameters[i].name;
173174
const paramName = currentName.kind === SyntaxKind.Identifier ?
174175
(<Identifier>currentName).text :
175176
"param" + i;
176-
177-
docParams += `${indentationStr} * @param ${paramName}${newLine}`;
177+
if (isJavaScriptFile) {
178+
docParams += `${indentationStr} * @param {any} ${paramName}${newLine}`;
179+
}
180+
else {
181+
docParams += `${indentationStr} * @param ${paramName}${newLine}`;
182+
}
178183
}
179184

180185
// A doc comment consists of the following

0 commit comments

Comments
 (0)