Fix doc comment template on assignment expressions (#38032)

This commit is contained in:
Andrew Branch 2020-04-20 10:15:12 -08:00 committed by GitHub
parent 5d78cbdbbd
commit 547fd12c2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View File

@ -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) {

View File

@ -0,0 +1,15 @@
/// <reference path='fourslash.ts' />
// @allowJs: true
// @checkJs: true
// @Filename: index.js
//// /** /**/ */
//// exports.foo = (a) => {};
verify.docCommentTemplateAt("", 8,
`/**
*
* @param {any} a
*/`);