Skip to content

Commit b967bbb

Browse files
committed
Test @typedef in @typedef-only JS files
Previously there was nothing for the @typedef to attach to, so the comment was never parsed. Now these comments attach to the EOF token.
1 parent 6d3e15f commit b967bbb

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
=== tests/cases/conformance/jsdoc/dtsEquivalent.js ===
2+
/** @typedef {{[k: string]: any}} AnyEffect */
3+
No type information for this code./** @typedef {number} Third */
4+
No type information for this code.=== tests/cases/conformance/jsdoc/index.js ===
5+
/** @type {AnyEffect} */
6+
let b;
7+
>b : Symbol(b, Decl(index.js, 1, 3))
8+
9+
/** @type {Third} */
10+
let c;
11+
>c : Symbol(c, Decl(index.js, 3, 3))
12+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
=== tests/cases/conformance/jsdoc/dtsEquivalent.js ===
2+
/** @typedef {{[k: string]: any}} AnyEffect */
3+
No type information for this code./** @typedef {number} Third */
4+
No type information for this code.=== tests/cases/conformance/jsdoc/index.js ===
5+
/** @type {AnyEffect} */
6+
let b;
7+
>b : { [k: string]: any; }
8+
9+
/** @type {Third} */
10+
let c;
11+
>c : number
12+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// @allowJs: true
2+
// @checkJs: true
3+
// @noEmit: true
4+
// @Filename: dtsEquivalent.js
5+
/** @typedef {{[k: string]: any}} AnyEffect */
6+
/** @typedef {number} Third */
7+
// @Filename: index.js
8+
/** @type {AnyEffect} */
9+
let b;
10+
/** @type {Third} */
11+
let c;

0 commit comments

Comments
 (0)