mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 04:43:37 -05:00
Merge pull request #12722 from Microsoft/correctCommentsScaffolding
Add parameters' type information in JSDoc comments scaffolding
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* @internal */
|
||||
/* @internal */
|
||||
namespace ts.JsDoc {
|
||||
const jsDocTagNames = [
|
||||
"augments",
|
||||
@@ -166,6 +166,7 @@ namespace ts.JsDoc {
|
||||
const lineStart = sourceFile.getLineStarts()[posLineAndChar.line];
|
||||
|
||||
const indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character);
|
||||
const isJavaScriptFile = hasJavaScriptFileExtension(sourceFile.fileName);
|
||||
|
||||
let docParams = "";
|
||||
for (let i = 0, numParams = parameters.length; i < numParams; i++) {
|
||||
@@ -173,8 +174,12 @@ namespace ts.JsDoc {
|
||||
const paramName = currentName.kind === SyntaxKind.Identifier ?
|
||||
(<Identifier>currentName).text :
|
||||
"param" + i;
|
||||
|
||||
docParams += `${indentationStr} * @param ${paramName}${newLine}`;
|
||||
if (isJavaScriptFile) {
|
||||
docParams += `${indentationStr} * @param {any} ${paramName}${newLine}`;
|
||||
}
|
||||
else {
|
||||
docParams += `${indentationStr} * @param ${paramName}${newLine}`;
|
||||
}
|
||||
}
|
||||
|
||||
// A doc comment consists of the following
|
||||
|
||||
Reference in New Issue
Block a user