Skip to content

Commit 5c7c113

Browse files
author
Yui T
committed
Update tests and baselines
1 parent 10eae61 commit 5c7c113

File tree

4 files changed

+116
-9
lines changed

4 files changed

+116
-9
lines changed

tests/baselines/reference/checkJsdocTypedefInParamTag1.js

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,26 @@
99
*
1010
* @param {Opts} opts
1111
*/
12-
function foo(opts) {}
12+
function foo(opts) {
13+
opts.x;
14+
}
1315

14-
foo({x: 'abc'});
16+
foo({x: 'abc'});
17+
18+
/**
19+
* @typedef {object} Opts1
20+
* @property {string} x
21+
* @property {string=} y
22+
* @property {string} [z]
23+
* @property {string} [w="hi"]
24+
*
25+
* @param {Opts1} opts
26+
*/
27+
function foo1(opts) {
28+
opts.x;
29+
}
30+
foo1({x: 'abc'});
31+
1532

1633
//// [0.js]
1734
// @ts-check
@@ -24,5 +41,20 @@ foo({x: 'abc'});
2441
*
2542
* @param {Opts} opts
2643
*/
27-
function foo(opts) { }
44+
function foo(opts) {
45+
opts.x;
46+
}
2847
foo({ x: 'abc' });
48+
/**
49+
* @typedef {object} Opts1
50+
* @property {string} x
51+
* @property {string=} y
52+
* @property {string} [z]
53+
* @property {string} [w="hi"]
54+
*
55+
* @param {Opts1} opts
56+
*/
57+
function foo1(opts) {
58+
opts.x;
59+
}
60+
foo1({ x: 'abc' });

tests/baselines/reference/checkJsdocTypedefInParamTag1.symbols

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,39 @@
99
*
1010
* @param {Opts} opts
1111
*/
12-
function foo(opts) {}
12+
function foo(opts) {
1313
>foo : Symbol(foo, Decl(0.js, 0, 0))
1414
>opts : Symbol(opts, Decl(0.js, 10, 13))
1515

16+
opts.x;
17+
>opts.x : Symbol(x, Decl(0.js, 3, 3))
18+
>opts : Symbol(opts, Decl(0.js, 10, 13))
19+
>x : Symbol(x, Decl(0.js, 3, 3))
20+
}
21+
1622
foo({x: 'abc'});
1723
>foo : Symbol(foo, Decl(0.js, 0, 0))
18-
>x : Symbol(x, Decl(0.js, 12, 5))
24+
>x : Symbol(x, Decl(0.js, 14, 5))
25+
26+
/**
27+
* @typedef {object} Opts1
28+
* @property {string} x
29+
* @property {string=} y
30+
* @property {string} [z]
31+
* @property {string} [w="hi"]
32+
*
33+
* @param {Opts1} opts
34+
*/
35+
function foo1(opts) {
36+
>foo1 : Symbol(foo1, Decl(0.js, 14, 16))
37+
>opts : Symbol(opts, Decl(0.js, 25, 14))
38+
39+
opts.x;
40+
>opts.x : Symbol(x, Decl(0.js, 18, 3))
41+
>opts : Symbol(opts, Decl(0.js, 25, 14))
42+
>x : Symbol(x, Decl(0.js, 18, 3))
43+
}
44+
foo1({x: 'abc'});
45+
>foo1 : Symbol(foo1, Decl(0.js, 14, 16))
46+
>x : Symbol(x, Decl(0.js, 28, 6))
1947

tests/baselines/reference/checkJsdocTypedefInParamTag1.types

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,45 @@
99
*
1010
* @param {Opts} opts
1111
*/
12-
function foo(opts) {}
12+
function foo(opts) {
1313
>foo : (opts: { x: string; y?: string; z?: string; w?: string; }) => void
1414
>opts : { x: string; y?: string; z?: string; w?: string; }
1515

16+
opts.x;
17+
>opts.x : string
18+
>opts : { x: string; y?: string; z?: string; w?: string; }
19+
>x : string
20+
}
21+
1622
foo({x: 'abc'});
1723
>foo({x: 'abc'}) : void
1824
>foo : (opts: { x: string; y?: string; z?: string; w?: string; }) => void
1925
>{x: 'abc'} : { x: string; }
2026
>x : string
2127
>'abc' : "abc"
2228

29+
/**
30+
* @typedef {object} Opts1
31+
* @property {string} x
32+
* @property {string=} y
33+
* @property {string} [z]
34+
* @property {string} [w="hi"]
35+
*
36+
* @param {Opts1} opts
37+
*/
38+
function foo1(opts) {
39+
>foo1 : (opts: { x: string; y?: string; z?: string; w?: string; }) => void
40+
>opts : { x: string; y?: string; z?: string; w?: string; }
41+
42+
opts.x;
43+
>opts.x : string
44+
>opts : { x: string; y?: string; z?: string; w?: string; }
45+
>x : string
46+
}
47+
foo1({x: 'abc'});
48+
>foo1({x: 'abc'}) : void
49+
>foo1 : (opts: { x: string; y?: string; z?: string; w?: string; }) => void
50+
>{x: 'abc'} : { x: string; }
51+
>x : string
52+
>'abc' : "abc"
53+

tests/cases/conformance/jsdoc/checkJsdocTypedefInParamTag1.ts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,25 @@
99
* @property {string=} y
1010
* @property {string} [z]
1111
* @property {string} [w="hi"]
12-
*
12+
*
1313
* @param {Opts} opts
1414
*/
15-
function foo(opts) {}
15+
function foo(opts) {
16+
opts.x;
17+
}
1618

17-
foo({x: 'abc'});
19+
foo({x: 'abc'});
20+
21+
/**
22+
* @typedef {object} Opts1
23+
* @property {string} x
24+
* @property {string=} y
25+
* @property {string} [z]
26+
* @property {string} [w="hi"]
27+
*
28+
* @param {Opts1} opts
29+
*/
30+
function foo1(opts) {
31+
opts.x;
32+
}
33+
foo1({x: 'abc'});

0 commit comments

Comments
 (0)