Skip to content

Commit 5dd9a1b

Browse files
Update Baselines and/or Applied Lint Fixes
1 parent 937cb4a commit 5dd9a1b

9 files changed

+200
-20
lines changed

tests/baselines/reference/checkJsdocTypeTag5.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ var k = function (x) { return x }
4444
/** @typedef {(x: 'hi' | 'bye') => 0 | 1 | 2} Argle */
4545
/** @type {Argle} */
4646
function blargle(s) {
47-
>blargle : (s: "hi" | "bye") => 0 | 1 | 2
47+
>blargle : (x: 'hi' | 'bye') => 0 | 1 | 2
4848
>s : "hi" | "bye"
4949

5050
return 0;
@@ -55,7 +55,7 @@ function blargle(s) {
5555
var zeroonetwo = blargle('hi')
5656
>zeroonetwo : 0 | 1 | 2
5757
>blargle('hi') : 0 | 1 | 2
58-
>blargle : (s: "hi" | "bye") => 0 | 1 | 2
58+
>blargle : (x: "hi" | "bye") => 0 | 1 | 2
5959
>'hi' : "hi"
6060

6161
/** @typedef {{(s: string): 0 | 1; (b: boolean): 2 | 3 }} Gioconda */

tests/baselines/reference/checkJsdocTypeTag6.errors.txt

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
tests/cases/conformance/jsdoc/test.js(1,12): error TS8030: The type of a function declaration must match the function's signature.
22
tests/cases/conformance/jsdoc/test.js(7,5): error TS2322: Type '(prop: any) => void' is not assignable to type '{ prop: string; }'.
33
tests/cases/conformance/jsdoc/test.js(10,12): error TS8030: The type of a function declaration must match the function's signature.
4+
tests/cases/conformance/jsdoc/test.js(23,12): error TS8030: The type of a function declaration must match the function's signature.
5+
tests/cases/conformance/jsdoc/test.js(27,7): error TS2322: Type '(more: any) => void' is not assignable to type '() => void'.
6+
tests/cases/conformance/jsdoc/test.js(30,7): error TS2322: Type '(more: any) => void' is not assignable to type '() => void'.
7+
tests/cases/conformance/jsdoc/test.js(37,3): error TS2322: Type '(more: any) => void' is not assignable to type '() => void'.
8+
tests/cases/conformance/jsdoc/test.js(40,3): error TS2322: Type '(more: any) => void' is not assignable to type '() => void'.
49

510

6-
==== tests/cases/conformance/jsdoc/test.js (3 errors) ====
11+
==== tests/cases/conformance/jsdoc/test.js (8 errors) ====
712
/** @type {number} */
813
~~~~~~
914
!!! error TS8030: The type of a function declaration must match the function's signature.
@@ -28,4 +33,37 @@ tests/cases/conformance/jsdoc/test.js(10,12): error TS8030: The type of a functi
2833
// TODO: Should be an error since signature doesn't match.
2934
/** @type {(a: number, b: number, c: number) => number} */
3035
function add3(a, b) { return a + b; }
36+
37+
// Confirm initializers are compatible.
38+
// They can't have more parameters than the target.
39+
40+
/** @type {() => void} */
41+
~~~~~~~~~~
42+
!!! error TS8030: The type of a function declaration must match the function's signature.
43+
function func(more) {}
44+
45+
/** @type {() => void} */
46+
const variable = function (more) {};
47+
~~~~~~~~
48+
!!! error TS2322: Type '(more: any) => void' is not assignable to type '() => void'.
49+
50+
/** @type {() => void} */
51+
const arrow = (more) => {};
52+
~~~~~
53+
!!! error TS2322: Type '(more: any) => void' is not assignable to type '() => void'.
54+
55+
({
56+
/** @type {() => void} */
57+
method(more) {},
58+
59+
/** @type {() => void} */
60+
prop: function (more) {},
61+
~~~~~~~~~~~~~~~~~~~~~~~~
62+
!!! error TS2322: Type '(more: any) => void' is not assignable to type '() => void'.
63+
64+
/** @type {() => void} */
65+
arrow: (more) => {},
66+
~~~~~~~~~~~~~~~~~~~
67+
!!! error TS2322: Type '(more: any) => void' is not assignable to type '() => void'.
68+
});
3169

tests/baselines/reference/checkJsdocTypeTag6.symbols

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,39 @@ function add3(a, b) { return a + b; }
3737
>a : Symbol(a, Decl(test.js, 17, 14))
3838
>b : Symbol(b, Decl(test.js, 17, 16))
3939

40+
// Confirm initializers are compatible.
41+
// They can't have more parameters than the target.
42+
43+
/** @type {() => void} */
44+
function func(more) {}
45+
>func : Symbol(func, Decl(test.js, 17, 37))
46+
>more : Symbol(more, Decl(test.js, 23, 14))
47+
48+
/** @type {() => void} */
49+
const variable = function (more) {};
50+
>variable : Symbol(variable, Decl(test.js, 26, 5))
51+
>more : Symbol(more, Decl(test.js, 26, 27))
52+
53+
/** @type {() => void} */
54+
const arrow = (more) => {};
55+
>arrow : Symbol(arrow, Decl(test.js, 29, 5))
56+
>more : Symbol(more, Decl(test.js, 29, 15))
57+
58+
({
59+
/** @type {() => void} */
60+
method(more) {},
61+
>method : Symbol(method, Decl(test.js, 31, 2))
62+
>more : Symbol(more, Decl(test.js, 33, 9))
63+
64+
/** @type {() => void} */
65+
prop: function (more) {},
66+
>prop : Symbol(prop, Decl(test.js, 33, 18))
67+
>more : Symbol(more, Decl(test.js, 36, 18))
68+
69+
/** @type {() => void} */
70+
arrow: (more) => {},
71+
>arrow : Symbol(arrow, Decl(test.js, 36, 27))
72+
>more : Symbol(more, Decl(test.js, 39, 10))
73+
74+
});
75+

tests/baselines/reference/checkJsdocTypeTag6.types

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ var g = function (prop) {
1616

1717
/** @type {(a: number) => number} */
1818
function add1(a, b) { return a + b; }
19-
>add1 : (a: number, b: any) => number
19+
>add1 : (a: number) => number
2020
>a : number
2121
>b : any
2222
>a + b : any
@@ -35,10 +35,53 @@ function add2(a, b) { return a + b; }
3535
// TODO: Should be an error since signature doesn't match.
3636
/** @type {(a: number, b: number, c: number) => number} */
3737
function add3(a, b) { return a + b; }
38-
>add3 : (a: number, b: number) => number
38+
>add3 : (a: number, b: number, c: number) => number
3939
>a : number
4040
>b : number
4141
>a + b : number
4242
>a : number
4343
>b : number
4444

45+
// Confirm initializers are compatible.
46+
// They can't have more parameters than the target.
47+
48+
/** @type {() => void} */
49+
function func(more) {}
50+
>func : () => void
51+
>more : any
52+
53+
/** @type {() => void} */
54+
const variable = function (more) {};
55+
>variable : () => void
56+
>function (more) {} : (more: any) => void
57+
>more : any
58+
59+
/** @type {() => void} */
60+
const arrow = (more) => {};
61+
>arrow : () => void
62+
>(more) => {} : (more: any) => void
63+
>more : any
64+
65+
({
66+
>({ /** @type {() => void} */ method(more) {}, /** @type {() => void} */ prop: function (more) {}, /** @type {() => void} */ arrow: (more) => {},}) : { method(): void; prop: () => void; arrow: () => void; }
67+
>{ /** @type {() => void} */ method(more) {}, /** @type {() => void} */ prop: function (more) {}, /** @type {() => void} */ arrow: (more) => {},} : { method(): void; prop: () => void; arrow: () => void; }
68+
69+
/** @type {() => void} */
70+
method(more) {},
71+
>method : () => void
72+
>more : any
73+
74+
/** @type {() => void} */
75+
prop: function (more) {},
76+
>prop : () => void
77+
>function (more) {} : (more: any) => void
78+
>more : any
79+
80+
/** @type {() => void} */
81+
arrow: (more) => {},
82+
>arrow : () => void
83+
>(more) => {} : (more: any) => void
84+
>more : any
85+
86+
});
87+

tests/baselines/reference/checkJsdocTypeTagOnObjectProperty1.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const obj = {
2020

2121
/** @type {function(number): number} */
2222
method1(n1) {
23-
>method1 : (n1: number) => number
23+
>method1 : (arg0: number) => number
2424
>n1 : number
2525

2626
return n1 + 42;

tests/baselines/reference/checkJsdocTypeTagOnObjectProperty2.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const obj = {
1414

1515
/** @type {function(number): number} */
1616
method1(n1) {
17-
>method1 : (n1: number) => number
17+
>method1 : (arg0: number) => number
1818
>n1 : number
1919

2020
return "42";

tests/baselines/reference/jsDocDontBreakWithNamespaces.baseline

Lines changed: 72 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -181,19 +181,82 @@
181181
"kind": "space"
182182
}
183183
],
184-
"parameters": [],
185-
"documentation": [],
186-
"tags": [
184+
"parameters": [
187185
{
188-
"name": "type",
189-
"text": [
186+
"name": "arg0",
187+
"documentation": [],
188+
"displayParts": [
190189
{
191-
"text": "{function(module:xxxx, module:xxxx): module:xxxxx}",
192-
"kind": "text"
190+
"text": "arg0",
191+
"kind": "parameterName"
192+
},
193+
{
194+
"text": ":",
195+
"kind": "punctuation"
196+
},
197+
{
198+
"text": " ",
199+
"kind": "space"
200+
},
201+
{
202+
"text": "any",
203+
"kind": "keyword"
193204
}
194-
]
205+
],
206+
"isOptional": false,
207+
"isRest": false
208+
},
209+
{
210+
"name": "arg1",
211+
"documentation": [],
212+
"displayParts": [
213+
{
214+
"text": "arg1",
215+
"kind": "parameterName"
216+
},
217+
{
218+
"text": ":",
219+
"kind": "punctuation"
220+
},
221+
{
222+
"text": " ",
223+
"kind": "space"
224+
},
225+
{
226+
"text": "any",
227+
"kind": "keyword"
228+
}
229+
],
230+
"isOptional": false,
231+
"isRest": false
232+
},
233+
{
234+
"name": "arg2",
235+
"documentation": [],
236+
"displayParts": [
237+
{
238+
"text": "arg2",
239+
"kind": "parameterName"
240+
},
241+
{
242+
"text": ":",
243+
"kind": "punctuation"
244+
},
245+
{
246+
"text": " ",
247+
"kind": "space"
248+
},
249+
{
250+
"text": "any",
251+
"kind": "keyword"
252+
}
253+
],
254+
"isOptional": false,
255+
"isRest": false
195256
}
196-
]
257+
],
258+
"documentation": [],
259+
"tags": []
197260
}
198261
],
199262
"applicableSpan": {

tests/baselines/reference/jsdocTypeTagRequiredParameters.errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ tests/cases/conformance/jsdoc/a.js(13,1): error TS2554: Expected 1 arguments, bu
2121
g() // should error
2222
~~~
2323
!!! error TS2554: Expected 1 arguments, but got 0.
24-
!!! related TS6210 tests/cases/conformance/jsdoc/a.js:5:12: An argument for 's' was not provided.
24+
!!! related TS6210 tests/cases/conformance/jsdoc/a.js:4:13: An argument for 's' was not provided.
2525
h()
2626
~~~
2727
!!! error TS2554: Expected 1 arguments, but got 0.
28-
!!! related TS6210 tests/cases/conformance/jsdoc/a.js:8:12: An argument for 's' was not provided.
28+
!!! related TS6210 tests/cases/conformance/jsdoc/a.js:7:14: An argument for 's' was not provided.
2929

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
=== tests/cases/conformance/jsdoc/bug25618.js ===
22
/** @type {<T>(param?: T) => T | undefined} */
33
function typed(param) {
4-
>typed : <T>(param: T | undefined) => T | undefined
4+
>typed : <T>(param?: T | undefined) => T | undefined
55
>param : T | undefined
66

77
return param;
@@ -11,7 +11,7 @@ function typed(param) {
1111
var n = typed(1);
1212
>n : number | undefined
1313
>typed(1) : 1 | undefined
14-
>typed : <T>(param: T | undefined) => T | undefined
14+
>typed : <T>(param?: T | undefined) => T | undefined
1515
>1 : 1
1616

1717

0 commit comments

Comments
 (0)