Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix jsdoc iterator on expression of export assignment #30558

Merged
merged 1 commit into from Apr 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions src/compiler/utilities.ts
Expand Up @@ -2217,6 +2217,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) ||
Expand Down
15 changes: 15 additions & 0 deletions tests/baselines/reference/exportDefaultWithJSDoc1.symbols
@@ -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 changes: 19 additions & 0 deletions tests/baselines/reference/exportDefaultWithJSDoc1.types
@@ -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 changes: 15 additions & 0 deletions tests/baselines/reference/exportDefaultWithJSDoc2.symbols
@@ -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 changes: 19 additions & 0 deletions tests/baselines/reference/exportDefaultWithJSDoc2.types
@@ -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 changes: 16 additions & 0 deletions tests/cases/compiler/exportDefaultWithJSDoc1.ts
@@ -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 changes: 16 additions & 0 deletions tests/cases/compiler/exportDefaultWithJSDoc2.ts
@@ -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]