Skip to content

Commit 1545ab5

Browse files
Use a loop because reduce is unreadable.
1 parent b2821c5 commit 1545ab5

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

src/services/services.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7030,6 +7030,7 @@ namespace ts {
70307030
// - class decls
70317031
let containingFunction = <FunctionDeclaration>getAncestor(tokenAtPos, SyntaxKind.FunctionDeclaration);
70327032

7033+
70337034
if (!containingFunction || containingFunction.getStart() < position) {
70347035
return undefined;
70357036
}
@@ -7043,9 +7044,15 @@ namespace ts {
70437044
// TODO: call a helper method instead once PR #4133 gets merged in.
70447045
const newLine = host.getNewLine ? host.getNewLine() : "\r\n";
70457046

7046-
let docParams = parameters.reduce((prev, cur, index) =>
7047-
prev +
7048-
indentationStr + " * @param " + (cur.name.kind === SyntaxKind.Identifier ? (<Identifier>cur.name).text : "param" + index) + newLine, "");
7047+
let docParams = "";
7048+
for (let i = 0, numParams = parameters.length; i < numParams; i++) {
7049+
const currentName = parameters[i].name;
7050+
const paramName = currentName.kind === SyntaxKind.Identifier ?
7051+
(<Identifier>currentName).text :
7052+
"param" + i;
7053+
7054+
docParams += `${indentationStr} * @param ${paramName}${newLine}`;
7055+
}
70497056

70507057
// A doc comment consists of the following
70517058
// * The opening comment line

0 commit comments

Comments
 (0)