Skip to content

Commit 07ce4bd

Browse files
authored
Merge pull request #12722 from Microsoft/correctCommentsScaffolding
Add parameters' type information in JSDoc comments scaffolding
2 parents f79fca7 + 7073b35 commit 07ce4bd

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/services/jsDoc.ts

+8-3
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",
@@ -166,15 +166,20 @@ namespace ts.JsDoc {
166166
const lineStart = sourceFile.getLineStarts()[posLineAndChar.line];
167167

168168
const indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character);
169+
const isJavaScriptFile = hasJavaScriptFileExtension(sourceFile.fileName);
169170

170171
let docParams = "";
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)