Merge pull request #12722 from Microsoft/correctCommentsScaffolding

Add parameters' type information in JSDoc comments scaffolding
This commit is contained in:
anubmat
2016-12-08 11:37:15 -08:00
committed by GitHub

View File

@@ -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