From c970c7898588775db355988b440fc1ea313d9de4 Mon Sep 17 00:00:00 2001 From: Anubha Mathur Date: Wed, 16 Nov 2016 13:59:06 -0800 Subject: [PATCH] Add parameter type in function support comments for JS files --- src/services/jsDoc.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index 5e2f5e7b4c9..9b83acd1a83 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -1,4 +1,4 @@ -/* @internal */ +/* @internal */ namespace ts.JsDoc { const jsDocTagNames = [ "augments", @@ -168,13 +168,18 @@ namespace ts.JsDoc { const indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character); let docParams = ""; + let isJavaScriptFile = hasJavaScriptFileExtension(sourceFile.fileName); // JSX or JS file for (let i = 0, numParams = parameters.length; i < numParams; i++) { const currentName = parameters[i].name; const paramName = currentName.kind === SyntaxKind.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