Skip to content

Commit 1e49ad8

Browse files
authored
fix(40685): fix generating docs for arrow functions (#40728)
1 parent 66c877f commit 1e49ad8

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

src/services/jsDoc.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ namespace ts.JsDoc {
329329
case SyntaxKind.MethodDeclaration:
330330
case SyntaxKind.Constructor:
331331
case SyntaxKind.MethodSignature:
332+
case SyntaxKind.ArrowFunction:
332333
const { parameters } = commentOwner as FunctionDeclaration | MethodDeclaration | ConstructorDeclaration | MethodSignature;
333334
return { commentOwner, parameters };
334335

tests/cases/fourslash/docCommentTemplateObjectLiteralMethods01.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,15 @@ const multiLineOffset = 12;
88
//// foo() {
99
//// return undefined;
1010
//// }
11+
////
1112
//// /*1*/
1213
//// [1 + 2 + 3 + Math.rand()](x: number, y: string, z = true) { }
14+
////
1315
//// /*2*/
14-
//// m: function(a) {}
16+
//// m1: function(a) {}
17+
////
18+
//// /*3*/
19+
//// m2: (a: string, b: string) => {}
1520
////}
1621

1722
verify.docCommentTemplateAt("0", singleLineOffset, "/** */");
@@ -23,9 +28,16 @@ verify.docCommentTemplateAt("1", multiLineOffset,
2328
* @param y
2429
* @param z
2530
*/`);
26-
31+
2732
verify.docCommentTemplateAt("2", multiLineOffset,
2833
`/**
2934
*
3035
* @param a
3136
*/`);
37+
38+
verify.docCommentTemplateAt("3", multiLineOffset,
39+
`/**
40+
*
41+
* @param a
42+
* @param b
43+
*/`);

0 commit comments

Comments
 (0)