mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-20 10:29:36 -06:00
fix jsdoc iterator on expression of export assignment (#30558)
This commit is contained in:
parent
867c992021
commit
b8e3c41ee1
@ -2221,6 +2221,7 @@ namespace ts {
|
||||
function getNextJSDocCommentLocation(node: Node) {
|
||||
const parent = node.parent;
|
||||
if (parent.kind === SyntaxKind.PropertyAssignment ||
|
||||
parent.kind === SyntaxKind.ExportAssignment ||
|
||||
parent.kind === SyntaxKind.PropertyDeclaration ||
|
||||
parent.kind === SyntaxKind.ExpressionStatement && node.kind === SyntaxKind.PropertyAccessExpression ||
|
||||
getNestedModuleDeclaration(parent) ||
|
||||
|
||||
15
tests/baselines/reference/exportDefaultWithJSDoc1.symbols
Normal file
15
tests/baselines/reference/exportDefaultWithJSDoc1.symbols
Normal file
@ -0,0 +1,15 @@
|
||||
=== tests/cases/compiler/a.js ===
|
||||
/**
|
||||
No type information for this code. * A number, or a string containing a number.
|
||||
No type information for this code. * @typedef {(number|string)} NumberLike
|
||||
No type information for this code. */
|
||||
No type information for this code.
|
||||
No type information for this code./** @type {NumberLike[]} */export default ([ ]);
|
||||
No type information for this code.
|
||||
No type information for this code.=== tests/cases/compiler/b.ts ===
|
||||
import A from './a'
|
||||
>A : Symbol(A, Decl(b.ts, 0, 6))
|
||||
|
||||
A[0]
|
||||
>A : Symbol(A, Decl(b.ts, 0, 6))
|
||||
|
||||
19
tests/baselines/reference/exportDefaultWithJSDoc1.types
Normal file
19
tests/baselines/reference/exportDefaultWithJSDoc1.types
Normal file
@ -0,0 +1,19 @@
|
||||
=== tests/cases/compiler/a.js ===
|
||||
/**
|
||||
* A number, or a string containing a number.
|
||||
* @typedef {(number|string)} NumberLike
|
||||
*/
|
||||
|
||||
/** @type {NumberLike[]} */export default ([ ]);
|
||||
>([ ]) : (string | number)[]
|
||||
>[ ] : undefined[]
|
||||
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
import A from './a'
|
||||
>A : (string | number)[]
|
||||
|
||||
A[0]
|
||||
>A[0] : string | number
|
||||
>A : (string | number)[]
|
||||
>0 : 0
|
||||
|
||||
15
tests/baselines/reference/exportDefaultWithJSDoc2.symbols
Normal file
15
tests/baselines/reference/exportDefaultWithJSDoc2.symbols
Normal file
@ -0,0 +1,15 @@
|
||||
=== tests/cases/compiler/a.js ===
|
||||
/**
|
||||
No type information for this code. * A number, or a string containing a number.
|
||||
No type information for this code. * @typedef {(number|string)} NumberLike
|
||||
No type information for this code. */
|
||||
No type information for this code.
|
||||
No type information for this code.export default /** @type {NumberLike[]} */([ ]);
|
||||
No type information for this code.
|
||||
No type information for this code.=== tests/cases/compiler/b.ts ===
|
||||
import A from './a'
|
||||
>A : Symbol(A, Decl(b.ts, 0, 6))
|
||||
|
||||
A[0]
|
||||
>A : Symbol(A, Decl(b.ts, 0, 6))
|
||||
|
||||
19
tests/baselines/reference/exportDefaultWithJSDoc2.types
Normal file
19
tests/baselines/reference/exportDefaultWithJSDoc2.types
Normal file
@ -0,0 +1,19 @@
|
||||
=== tests/cases/compiler/a.js ===
|
||||
/**
|
||||
* A number, or a string containing a number.
|
||||
* @typedef {(number|string)} NumberLike
|
||||
*/
|
||||
|
||||
export default /** @type {NumberLike[]} */([ ]);
|
||||
>([ ]) : (string | number)[]
|
||||
>[ ] : undefined[]
|
||||
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
import A from './a'
|
||||
>A : (string | number)[]
|
||||
|
||||
A[0]
|
||||
>A[0] : string | number
|
||||
>A : (string | number)[]
|
||||
>0 : 0
|
||||
|
||||
16
tests/cases/compiler/exportDefaultWithJSDoc1.ts
Normal file
16
tests/cases/compiler/exportDefaultWithJSDoc1.ts
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
// @allowJs: true
|
||||
// @checkJs: true
|
||||
// @noEmit: true
|
||||
|
||||
/**
|
||||
* A number, or a string containing a number.
|
||||
* @typedef {(number|string)} NumberLike
|
||||
*/
|
||||
|
||||
// @Filename: a.js
|
||||
/** @type {NumberLike[]} */export default ([ ]);
|
||||
|
||||
// @Filename: b.ts
|
||||
import A from './a'
|
||||
A[0]
|
||||
16
tests/cases/compiler/exportDefaultWithJSDoc2.ts
Normal file
16
tests/cases/compiler/exportDefaultWithJSDoc2.ts
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
// @allowJs: true
|
||||
// @checkJs: true
|
||||
// @noEmit: true
|
||||
|
||||
/**
|
||||
* A number, or a string containing a number.
|
||||
* @typedef {(number|string)} NumberLike
|
||||
*/
|
||||
|
||||
// @Filename: a.js
|
||||
export default /** @type {NumberLike[]} */([ ]);
|
||||
|
||||
// @Filename: b.ts
|
||||
import A from './a'
|
||||
A[0]
|
||||
Loading…
x
Reference in New Issue
Block a user