Skip to content

Commit 547fd12

Browse files
authored
Fix doc comment template on assignment expressions (microsoft#38032)
1 parent 5d78cbd commit 547fd12

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/services/jsDoc.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,8 @@ namespace ts.JsDoc {
363363
// want to give back a JSDoc template for the 'b' or 'c' in 'namespace a.b.c { }'.
364364
return commentOwner.parent.kind === SyntaxKind.ModuleDeclaration ? undefined : { commentOwner };
365365

366+
case SyntaxKind.ExpressionStatement:
367+
return getCommentOwnerInfoWorker((commentOwner as ExpressionStatement).expression);
366368
case SyntaxKind.BinaryExpression: {
367369
const be = commentOwner as BinaryExpression;
368370
if (getAssignmentDeclarationKind(be) === AssignmentDeclarationKind.None) {
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
// @allowJs: true
4+
// @checkJs: true
5+
6+
// @Filename: index.js
7+
//// /** /**/ */
8+
//// exports.foo = (a) => {};
9+
10+
11+
verify.docCommentTemplateAt("", 8,
12+
`/**
13+
*
14+
* @param {any} a
15+
*/`);

0 commit comments

Comments
 (0)