fix(40685): fix generating docs for arrow functions (#40728)

This commit is contained in:
Alex T
2020-10-06 07:50:08 -07:00
committed by GitHub
parent 66c877f57a
commit 1e49ad8370
2 changed files with 15 additions and 2 deletions
+1
View File
@@ -329,6 +329,7 @@ namespace ts.JsDoc {
case SyntaxKind.MethodDeclaration:
case SyntaxKind.Constructor:
case SyntaxKind.MethodSignature:
case SyntaxKind.ArrowFunction:
const { parameters } = commentOwner as FunctionDeclaration | MethodDeclaration | ConstructorDeclaration | MethodSignature;
return { commentOwner, parameters };
@@ -8,10 +8,15 @@ const multiLineOffset = 12;
//// foo() {
//// return undefined;
//// }
////
//// /*1*/
//// [1 + 2 + 3 + Math.rand()](x: number, y: string, z = true) { }
////
//// /*2*/
//// m: function(a) {}
//// m1: function(a) {}
////
//// /*3*/
//// m2: (a: string, b: string) => {}
////}
verify.docCommentTemplateAt("0", singleLineOffset, "/** */");
@@ -23,9 +28,16 @@ verify.docCommentTemplateAt("1", multiLineOffset,
* @param y
* @param z
*/`);
verify.docCommentTemplateAt("2", multiLineOffset,
`/**
*
* @param a
*/`);
verify.docCommentTemplateAt("3", multiLineOffset,
`/**
*
* @param a
* @param b
*/`);