diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index 7118fe8b761..63297c7868d 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -363,6 +363,8 @@ namespace ts.JsDoc { // want to give back a JSDoc template for the 'b' or 'c' in 'namespace a.b.c { }'. return commentOwner.parent.kind === SyntaxKind.ModuleDeclaration ? undefined : { commentOwner }; + case SyntaxKind.ExpressionStatement: + return getCommentOwnerInfoWorker((commentOwner as ExpressionStatement).expression); case SyntaxKind.BinaryExpression: { const be = commentOwner as BinaryExpression; if (getAssignmentDeclarationKind(be) === AssignmentDeclarationKind.None) { diff --git a/tests/cases/fourslash/docCommentTemplateExportAssignmentJS.ts b/tests/cases/fourslash/docCommentTemplateExportAssignmentJS.ts new file mode 100644 index 00000000000..849227ba74b --- /dev/null +++ b/tests/cases/fourslash/docCommentTemplateExportAssignmentJS.ts @@ -0,0 +1,15 @@ +/// + +// @allowJs: true +// @checkJs: true + +// @Filename: index.js +//// /** /**/ */ +//// exports.foo = (a) => {}; + + +verify.docCommentTemplateAt("", 8, +`/** + * + * @param {any} a + */`);