No dupe jsdoc for assignment inside an initializer

This commit is contained in:
Nathan Shively-Sanders
2018-06-15 13:50:51 -07:00
parent da1d3cce6f
commit e614e857e9
5 changed files with 35 additions and 1 deletions
+6 -1
View File
@@ -1894,7 +1894,12 @@ namespace ts {
if (isBinaryExpression(node) && node.operatorToken.kind === SyntaxKind.EqualsToken ||
isBinaryExpression(parent) && parent.operatorToken.kind === SyntaxKind.EqualsToken ||
node.kind === SyntaxKind.PropertyAccessExpression && node.parent && node.parent.kind === SyntaxKind.ExpressionStatement) {
getJSDocCommentsAndTagsWorker(parent);
if (isBinaryExpression(parent)) {
getJSDocCommentsAndTagsWorker(parent.parent);
}
else {
getJSDocCommentsAndTagsWorker(parent);
}
}
// Pull parameter comments from declaring function as well
@@ -0,0 +1,9 @@
tests/cases/conformance/jsdoc/a.js(2,11): error TS2304: Cannot find name 'b'.
==== tests/cases/conformance/jsdoc/a.js (1 errors) ====
/** doc */
const a = b = () => 0;
~
!!! error TS2304: Cannot find name 'b'.
@@ -0,0 +1,5 @@
=== tests/cases/conformance/jsdoc/a.js ===
/** doc */
const a = b = () => 0;
>a : Symbol(a, Decl(a.js, 1, 5))
@@ -0,0 +1,9 @@
=== tests/cases/conformance/jsdoc/a.js ===
/** doc */
const a = b = () => 0;
>a : () => number
>b = () => 0 : () => number
>b : any
>() => 0 : () => number
>0 : 0
@@ -0,0 +1,6 @@
// @allowJs: true
// @checkJs: true
// @noEmit: true
// @Filename: a.js
/** doc */
const a = b = () => 0;