Skip to content

Commit 742911b

Browse files
committed
add tests
1 parent 04d2c8e commit 742911b

File tree

4 files changed

+106
-0
lines changed

4 files changed

+106
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/a.js(7,7): error TS2322: Type 'number' is not assignable to type 'T'.
2+
3+
4+
==== /a.js (1 errors) ====
5+
/**
6+
* @typedef {object} T
7+
* @property {boolean} await
8+
*/
9+
10+
/** @type {T} */
11+
const a = 1;
12+
~
13+
!!! error TS2322: Type 'number' is not assignable to type 'T'.
14+
15+
/** @type {T} */
16+
const b = {
17+
await: false,
18+
};
19+
20+
/**
21+
* @param {boolean} await
22+
*/
23+
function c(await) {}
24+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//// [tests/cases/conformance/jsdoc/jsdocParseAwait.ts] ////
2+
3+
=== /a.js ===
4+
/**
5+
* @typedef {object} T
6+
* @property {boolean} await
7+
*/
8+
9+
/** @type {T} */
10+
const a = 1;
11+
>a : Symbol(a, Decl(a.js, 6, 5))
12+
13+
/** @type {T} */
14+
const b = {
15+
>b : Symbol(b, Decl(a.js, 9, 5))
16+
17+
await: false,
18+
>await : Symbol(await, Decl(a.js, 9, 11))
19+
20+
};
21+
22+
/**
23+
* @param {boolean} await
24+
*/
25+
function c(await) {}
26+
>c : Symbol(c, Decl(a.js, 11, 2))
27+
>await : Symbol(await, Decl(a.js, 16, 11))
28+
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
//// [tests/cases/conformance/jsdoc/jsdocParseAwait.ts] ////
2+
3+
=== /a.js ===
4+
/**
5+
* @typedef {object} T
6+
* @property {boolean} await
7+
*/
8+
9+
/** @type {T} */
10+
const a = 1;
11+
>a : T
12+
>1 : 1
13+
14+
/** @type {T} */
15+
const b = {
16+
>b : T
17+
>{ await: false,} : { await: boolean; }
18+
19+
await: false,
20+
>await : boolean
21+
>false : false
22+
23+
};
24+
25+
/**
26+
* @param {boolean} await
27+
*/
28+
function c(await) {}
29+
>c : (await: boolean) => void
30+
>await : boolean
31+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// @allowJs: true
2+
// @checkJs: true
3+
// @noEmit: true
4+
5+
// @Filename: /a.js
6+
7+
/**
8+
* @typedef {object} T
9+
* @property {boolean} await
10+
*/
11+
12+
/** @type {T} */
13+
const a = 1;
14+
15+
/** @type {T} */
16+
const b = {
17+
await: false,
18+
};
19+
20+
/**
21+
* @param {boolean} await
22+
*/
23+
function c(await) {}

0 commit comments

Comments
 (0)