File tree Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -439,12 +439,18 @@ namespace ts.JsDoc {
439439
440440 case SyntaxKind . ClassDeclaration :
441441 case SyntaxKind . InterfaceDeclaration :
442- case SyntaxKind . PropertySignature :
443442 case SyntaxKind . EnumDeclaration :
444443 case SyntaxKind . EnumMember :
445444 case SyntaxKind . TypeAliasDeclaration :
446445 return { commentOwner } ;
447446
447+ case SyntaxKind . PropertySignature : {
448+ const host = commentOwner as PropertySignature ;
449+ return host . type && isFunctionTypeNode ( host . type )
450+ ? { commentOwner, parameters : host . type . parameters , hasReturn : hasReturn ( host . type , options ) }
451+ : { commentOwner } ;
452+ }
453+
448454 case SyntaxKind . VariableStatement : {
449455 const varStatement = commentOwner as VariableStatement ;
450456 const varDeclarations = varStatement . declarationList . declarations ;
@@ -486,7 +492,7 @@ namespace ts.JsDoc {
486492
487493 function hasReturn ( node : Node , options : DocCommentTemplateOptions | undefined ) {
488494 return ! ! options ?. generateReturnInDocTemplate &&
489- ( isArrowFunction ( node ) && isExpression ( node . body )
495+ ( isFunctionTypeNode ( node ) || isArrowFunction ( node ) && isExpression ( node . body )
490496 || isFunctionLikeDeclaration ( node ) && node . body && isBlock ( node . body ) && ! ! forEachReturnStatement ( node . body , n => n ) ) ;
491497 }
492498
Original file line number Diff line number Diff line change 1+ /// <reference path="fourslash.ts" />
2+
3+ ////interface I {
4+ //// /**/
5+ //// foo: (a: number, b: string) => void;
6+ //// }
7+
8+ verify . docCommentTemplateAt ( "" , 12 ,
9+ `/**
10+ *
11+ * @param a
12+ * @param b
13+ * @returns
14+ */` ) ;
15+
16+ verify . docCommentTemplateAt ( "" , 12 ,
17+ `/**
18+ *
19+ * @param a
20+ * @param b
21+ */` , { generateReturnInDocTemplate : false } ) ;
You can’t perform that action at this time.
0 commit comments