mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-11 01:34:55 -06:00
No dupe jsdoc for assignment inside an initializer
This commit is contained in:
parent
da1d3cce6f
commit
e614e857e9
@ -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
|
||||
|
||||
9
tests/baselines/reference/noDuplicateJsdoc1.errors.txt
Normal file
9
tests/baselines/reference/noDuplicateJsdoc1.errors.txt
Normal file
@ -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'.
|
||||
|
||||
5
tests/baselines/reference/noDuplicateJsdoc1.symbols
Normal file
5
tests/baselines/reference/noDuplicateJsdoc1.symbols
Normal file
@ -0,0 +1,5 @@
|
||||
=== tests/cases/conformance/jsdoc/a.js ===
|
||||
/** doc */
|
||||
const a = b = () => 0;
|
||||
>a : Symbol(a, Decl(a.js, 1, 5))
|
||||
|
||||
9
tests/baselines/reference/noDuplicateJsdoc1.types
Normal file
9
tests/baselines/reference/noDuplicateJsdoc1.types
Normal file
@ -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
|
||||
|
||||
6
tests/cases/conformance/jsdoc/noDuplicateJsdoc1.ts
Normal file
6
tests/cases/conformance/jsdoc/noDuplicateJsdoc1.ts
Normal file
@ -0,0 +1,6 @@
|
||||
// @allowJs: true
|
||||
// @checkJs: true
|
||||
// @noEmit: true
|
||||
// @Filename: a.js
|
||||
/** doc */
|
||||
const a = b = () => 0;
|
||||
Loading…
x
Reference in New Issue
Block a user