Skip to content

Commit 6a481e8

Browse files
committed
Update tests
1 parent 91691f6 commit 6a481e8

File tree

3 files changed

+65
-29
lines changed

3 files changed

+65
-29
lines changed

tests/baselines/reference/strictFunctionTypesErrors.errors.txt

Lines changed: 63 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,19 @@ tests/cases/compiler/strictFunctionTypesErrors.ts(21,1): error TS2322: Type '(x:
1717
tests/cases/compiler/strictFunctionTypesErrors.ts(23,1): error TS2322: Type '(x: string) => Object' is not assignable to type '(x: string) => string'.
1818
Type 'Object' is not assignable to type 'string'.
1919
tests/cases/compiler/strictFunctionTypesErrors.ts(33,1): error TS2322: Type 'Func<string, Object>' is not assignable to type 'Func<Object, Object>'.
20-
Type 'Object' is not assignable to type 'string'.
20+
Types of parameters 'x' and 'x' are incompatible.
21+
Type 'Object' is not assignable to type 'string'.
2122
tests/cases/compiler/strictFunctionTypesErrors.ts(34,1): error TS2322: Type 'Func<string, string>' is not assignable to type 'Func<Object, Object>'.
22-
Type 'Object' is not assignable to type 'string'.
23+
Types of parameters 'x' and 'x' are incompatible.
24+
Type 'Object' is not assignable to type 'string'.
2325
tests/cases/compiler/strictFunctionTypesErrors.ts(36,1): error TS2322: Type 'Func<Object, Object>' is not assignable to type 'Func<Object, string>'.
2426
Type 'Object' is not assignable to type 'string'.
2527
tests/cases/compiler/strictFunctionTypesErrors.ts(37,1): error TS2322: Type 'Func<string, Object>' is not assignable to type 'Func<Object, string>'.
26-
Type 'Object' is not assignable to type 'string'.
28+
Types of parameters 'x' and 'x' are incompatible.
29+
Type 'Object' is not assignable to type 'string'.
2730
tests/cases/compiler/strictFunctionTypesErrors.ts(38,1): error TS2322: Type 'Func<string, string>' is not assignable to type 'Func<Object, string>'.
28-
Type 'Object' is not assignable to type 'string'.
31+
Types of parameters 'x' and 'x' are incompatible.
32+
Type 'Object' is not assignable to type 'string'.
2933
tests/cases/compiler/strictFunctionTypesErrors.ts(44,1): error TS2322: Type 'Func<Object, Object>' is not assignable to type 'Func<string, string>'.
3034
Type 'Object' is not assignable to type 'string'.
3135
tests/cases/compiler/strictFunctionTypesErrors.ts(46,1): error TS2322: Type 'Func<string, Object>' is not assignable to type 'Func<string, string>'.
@@ -35,32 +39,46 @@ tests/cases/compiler/strictFunctionTypesErrors.ts(57,1): error TS2322: Type 'Fun
3539
tests/cases/compiler/strictFunctionTypesErrors.ts(58,1): error TS2322: Type 'Func<Func<string, void>, Object>' is not assignable to type 'Func<Func<Object, void>, string>'.
3640
Type 'Object' is not assignable to type 'string'.
3741
tests/cases/compiler/strictFunctionTypesErrors.ts(61,1): error TS2322: Type 'Func<Func<Object, void>, Object>' is not assignable to type 'Func<Func<string, void>, Object>'.
38-
Type 'Func<string, void>' is not assignable to type 'Func<Object, void>'.
39-
Type 'Object' is not assignable to type 'string'.
42+
Types of parameters 'x' and 'x' are incompatible.
43+
Types of parameters 'x' and 'x' are incompatible.
44+
Type 'Object' is not assignable to type 'string'.
4045
tests/cases/compiler/strictFunctionTypesErrors.ts(62,1): error TS2322: Type 'Func<Func<Object, void>, string>' is not assignable to type 'Func<Func<string, void>, Object>'.
41-
Type 'Func<string, void>' is not assignable to type 'Func<Object, void>'.
46+
Types of parameters 'x' and 'x' are incompatible.
47+
Types of parameters 'x' and 'x' are incompatible.
48+
Type 'Object' is not assignable to type 'string'.
4249
tests/cases/compiler/strictFunctionTypesErrors.ts(65,1): error TS2322: Type 'Func<Func<Object, void>, Object>' is not assignable to type 'Func<Func<string, void>, string>'.
43-
Type 'Func<string, void>' is not assignable to type 'Func<Object, void>'.
50+
Types of parameters 'x' and 'x' are incompatible.
51+
Types of parameters 'x' and 'x' are incompatible.
52+
Type 'Object' is not assignable to type 'string'.
4453
tests/cases/compiler/strictFunctionTypesErrors.ts(66,1): error TS2322: Type 'Func<Func<Object, void>, string>' is not assignable to type 'Func<Func<string, void>, string>'.
45-
Type 'Func<string, void>' is not assignable to type 'Func<Object, void>'.
54+
Types of parameters 'x' and 'x' are incompatible.
55+
Types of parameters 'x' and 'x' are incompatible.
56+
Type 'Object' is not assignable to type 'string'.
4657
tests/cases/compiler/strictFunctionTypesErrors.ts(67,1): error TS2322: Type 'Func<Func<string, void>, Object>' is not assignable to type 'Func<Func<string, void>, string>'.
4758
Type 'Object' is not assignable to type 'string'.
4859
tests/cases/compiler/strictFunctionTypesErrors.ts(74,1): error TS2322: Type 'Func<Object, Func<string, void>>' is not assignable to type 'Func<Object, Func<Object, void>>'.
4960
Type 'Func<string, void>' is not assignable to type 'Func<Object, void>'.
61+
Types of parameters 'x' and 'x' are incompatible.
62+
Type 'Object' is not assignable to type 'string'.
5063
tests/cases/compiler/strictFunctionTypesErrors.ts(75,1): error TS2322: Type 'Func<string, Func<Object, void>>' is not assignable to type 'Func<Object, Func<Object, void>>'.
51-
Type 'Object' is not assignable to type 'string'.
64+
Types of parameters 'x' and 'x' are incompatible.
65+
Type 'Object' is not assignable to type 'string'.
5266
tests/cases/compiler/strictFunctionTypesErrors.ts(76,1): error TS2322: Type 'Func<string, Func<string, void>>' is not assignable to type 'Func<Object, Func<Object, void>>'.
53-
Type 'Object' is not assignable to type 'string'.
67+
Types of parameters 'x' and 'x' are incompatible.
68+
Type 'Object' is not assignable to type 'string'.
5469
tests/cases/compiler/strictFunctionTypesErrors.ts(79,1): error TS2322: Type 'Func<string, Func<Object, void>>' is not assignable to type 'Func<Object, Func<string, void>>'.
55-
Type 'Object' is not assignable to type 'string'.
70+
Types of parameters 'x' and 'x' are incompatible.
71+
Type 'Object' is not assignable to type 'string'.
5672
tests/cases/compiler/strictFunctionTypesErrors.ts(80,1): error TS2322: Type 'Func<string, Func<string, void>>' is not assignable to type 'Func<Object, Func<string, void>>'.
57-
Type 'Object' is not assignable to type 'string'.
73+
Types of parameters 'x' and 'x' are incompatible.
74+
Type 'Object' is not assignable to type 'string'.
5875
tests/cases/compiler/strictFunctionTypesErrors.ts(83,1): error TS2322: Type 'Func<Object, Func<string, void>>' is not assignable to type 'Func<string, Func<Object, void>>'.
5976
Type 'Func<string, void>' is not assignable to type 'Func<Object, void>'.
6077
tests/cases/compiler/strictFunctionTypesErrors.ts(84,1): error TS2322: Type 'Func<string, Func<string, void>>' is not assignable to type 'Func<string, Func<Object, void>>'.
6178
Type 'Func<string, void>' is not assignable to type 'Func<Object, void>'.
6279
tests/cases/compiler/strictFunctionTypesErrors.ts(111,1): error TS2322: Type 'Comparer2<Dog>' is not assignable to type 'Comparer2<Animal>'.
6380
Type 'Animal' is not assignable to type 'Dog'.
81+
Property 'dog' is missing in type 'Animal'.
6482

6583

6684
==== tests/cases/compiler/strictFunctionTypesErrors.ts (29 errors) ====
@@ -113,7 +131,7 @@ tests/cases/compiler/strictFunctionTypesErrors.ts(111,1): error TS2322: Type 'Co
113131
!!! error TS2322: Type '(x: string) => Object' is not assignable to type '(x: string) => string'.
114132
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
115133

116-
interface Func<T, U> { (x: T): U }
134+
type Func<T, U> = (x: T) => U;
117135

118136
declare let g1: Func<Object, Object>;
119137
declare let g2: Func<Object, string>;
@@ -124,11 +142,13 @@ tests/cases/compiler/strictFunctionTypesErrors.ts(111,1): error TS2322: Type 'Co
124142
g1 = g3; // Error
125143
~~
126144
!!! error TS2322: Type 'Func<string, Object>' is not assignable to type 'Func<Object, Object>'.
127-
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
145+
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
146+
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
128147
g1 = g4; // Error
129148
~~
130149
!!! error TS2322: Type 'Func<string, string>' is not assignable to type 'Func<Object, Object>'.
131-
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
150+
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
151+
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
132152

133153
g2 = g1; // Error
134154
~~
@@ -137,11 +157,13 @@ tests/cases/compiler/strictFunctionTypesErrors.ts(111,1): error TS2322: Type 'Co
137157
g2 = g3; // Error
138158
~~
139159
!!! error TS2322: Type 'Func<string, Object>' is not assignable to type 'Func<Object, string>'.
140-
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
160+
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
161+
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
141162
g2 = g4; // Error
142163
~~
143164
!!! error TS2322: Type 'Func<string, string>' is not assignable to type 'Func<Object, string>'.
144-
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
165+
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
166+
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
145167

146168
g3 = g1; // Ok
147169
g3 = g2; // Ok
@@ -179,22 +201,29 @@ tests/cases/compiler/strictFunctionTypesErrors.ts(111,1): error TS2322: Type 'Co
179201
h3 = h1; // Error
180202
~~
181203
!!! error TS2322: Type 'Func<Func<Object, void>, Object>' is not assignable to type 'Func<Func<string, void>, Object>'.
182-
!!! error TS2322: Type 'Func<string, void>' is not assignable to type 'Func<Object, void>'.
183-
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
204+
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
205+
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
206+
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
184207
h3 = h2; // Error
185208
~~
186209
!!! error TS2322: Type 'Func<Func<Object, void>, string>' is not assignable to type 'Func<Func<string, void>, Object>'.
187-
!!! error TS2322: Type 'Func<string, void>' is not assignable to type 'Func<Object, void>'.
210+
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
211+
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
212+
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
188213
h3 = h4; // Ok
189214

190215
h4 = h1; // Error
191216
~~
192217
!!! error TS2322: Type 'Func<Func<Object, void>, Object>' is not assignable to type 'Func<Func<string, void>, string>'.
193-
!!! error TS2322: Type 'Func<string, void>' is not assignable to type 'Func<Object, void>'.
218+
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
219+
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
220+
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
194221
h4 = h2; // Error
195222
~~
196223
!!! error TS2322: Type 'Func<Func<Object, void>, string>' is not assignable to type 'Func<Func<string, void>, string>'.
197-
!!! error TS2322: Type 'Func<string, void>' is not assignable to type 'Func<Object, void>'.
224+
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
225+
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
226+
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
198227
h4 = h3; // Error
199228
~~
200229
!!! error TS2322: Type 'Func<Func<string, void>, Object>' is not assignable to type 'Func<Func<string, void>, string>'.
@@ -209,24 +238,30 @@ tests/cases/compiler/strictFunctionTypesErrors.ts(111,1): error TS2322: Type 'Co
209238
~~
210239
!!! error TS2322: Type 'Func<Object, Func<string, void>>' is not assignable to type 'Func<Object, Func<Object, void>>'.
211240
!!! error TS2322: Type 'Func<string, void>' is not assignable to type 'Func<Object, void>'.
241+
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
242+
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
212243
i1 = i3; // Error
213244
~~
214245
!!! error TS2322: Type 'Func<string, Func<Object, void>>' is not assignable to type 'Func<Object, Func<Object, void>>'.
215-
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
246+
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
247+
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
216248
i1 = i4; // Error
217249
~~
218250
!!! error TS2322: Type 'Func<string, Func<string, void>>' is not assignable to type 'Func<Object, Func<Object, void>>'.
219-
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
251+
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
252+
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
220253

221254
i2 = i1; // Ok
222255
i2 = i3; // Error
223256
~~
224257
!!! error TS2322: Type 'Func<string, Func<Object, void>>' is not assignable to type 'Func<Object, Func<string, void>>'.
225-
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
258+
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
259+
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
226260
i2 = i4; // Error
227261
~~
228262
!!! error TS2322: Type 'Func<string, Func<string, void>>' is not assignable to type 'Func<Object, Func<string, void>>'.
229-
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
263+
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
264+
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
230265

231266
i3 = i1; // Ok
232267
i3 = i2; // Error
@@ -267,5 +302,6 @@ tests/cases/compiler/strictFunctionTypesErrors.ts(111,1): error TS2322: Type 'Co
267302
~~~~~~~~~~~~~~~
268303
!!! error TS2322: Type 'Comparer2<Dog>' is not assignable to type 'Comparer2<Animal>'.
269304
!!! error TS2322: Type 'Animal' is not assignable to type 'Dog'.
305+
!!! error TS2322: Property 'dog' is missing in type 'Animal'.
270306
dogComparer2 = animalComparer2; // Ok
271307

tests/baselines/reference/strictFunctionTypesErrors.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ f4 = f1; // Error
2323
f4 = f2; // Ok
2424
f4 = f3; // Error
2525

26-
interface Func<T, U> { (x: T): U }
26+
type Func<T, U> = (x: T) => U;
2727

2828
declare let g1: Func<Object, Object>;
2929
declare let g2: Func<Object, string>;

tests/cases/compiler/strictFunctionTypesErrors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ f4 = f1; // Error
2323
f4 = f2; // Ok
2424
f4 = f3; // Error
2525

26-
interface Func<T, U> { (x: T): U }
26+
type Func<T, U> = (x: T) => U;
2727

2828
declare let g1: Func<Object, Object>;
2929
declare let g2: Func<Object, string>;

0 commit comments

Comments
 (0)