You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hoist and distribute type parameter constraints over type parameters … (#33453)
* Hoist and distribute type parameter constraints over type parameters when comparing against union targets when fetching union constraints
* Fix PR nits
Copy file name to clipboardExpand all lines: tests/baselines/reference/intersectionWithUnionConstraint.errors.txt
+10-30Lines changed: 10 additions & 30 deletions
Original file line number
Diff line number
Diff line change
@@ -1,23 +1,13 @@
1
1
tests/cases/conformance/types/intersection/intersectionWithUnionConstraint.ts(7,9): error TS2322: Type 'T & U' is not assignable to type 'string | number'.
2
-
Type 'string | undefined' is not assignable to type 'string | number'.
3
-
Type 'undefined' is not assignable to type 'string | number'.
4
-
Type 'T & U' is not assignable to type 'number'.
2
+
Type 'T & U' is not assignable to type 'number'.
5
3
tests/cases/conformance/types/intersection/intersectionWithUnionConstraint.ts(8,9): error TS2322: Type 'T & U' is not assignable to type 'string | null'.
6
-
Type 'string | undefined' is not assignable to type 'string | null'.
7
-
Type 'undefined' is not assignable to type 'string | null'.
8
-
Type 'T & U' is not assignable to type 'string'.
4
+
Type 'T & U' is not assignable to type 'string'.
9
5
tests/cases/conformance/types/intersection/intersectionWithUnionConstraint.ts(10,9): error TS2322: Type 'T & U' is not assignable to type 'number | null'.
10
-
Type 'string | undefined' is not assignable to type 'number | null'.
11
-
Type 'undefined' is not assignable to type 'number | null'.
12
-
Type 'T & U' is not assignable to type 'number'.
6
+
Type 'T & U' is not assignable to type 'number'.
13
7
tests/cases/conformance/types/intersection/intersectionWithUnionConstraint.ts(11,9): error TS2322: Type 'T & U' is not assignable to type 'number | undefined'.
14
-
Type 'string | undefined' is not assignable to type 'number | undefined'.
15
-
Type 'string' is not assignable to type 'number | undefined'.
16
-
Type 'T & U' is not assignable to type 'number'.
8
+
Type 'T & U' is not assignable to type 'number'.
17
9
tests/cases/conformance/types/intersection/intersectionWithUnionConstraint.ts(12,9): error TS2322: Type 'T & U' is not assignable to type 'null | undefined'.
18
-
Type 'string | undefined' is not assignable to type 'null | undefined'.
19
-
Type 'string' is not assignable to type 'null | undefined'.
'string & keyof T' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string'.
49
49
Type 'string' is not assignable to type 'K'.
50
50
'string' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string'.
51
-
Type 'string' is not assignable to type 'K'.
52
-
'string' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string'.
53
51
tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(105,9): error TS2322: Type 'T[Extract<keyof T, string>]' is not assignable to type 'T[K]'.
54
52
Type 'Extract<keyof T, string>' is not assignable to type 'K'.
55
53
'Extract<keyof T, string>' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string'.
!!! error TS2322: 'string & keyof T' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string'.
265
261
!!! error TS2322: Type 'string' is not assignable to type 'K'.
266
262
!!! error TS2322: 'string' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string'.
267
-
!!! error TS2322: Type 'string' is not assignable to type 'K'.
268
-
!!! error TS2322: 'string' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string'.
!!! error TS2322: 'string & keyof T' is assignable to the constraint of type 'J', but 'J' could be instantiated with a different subtype of constraint 'string'.
300
294
!!! error TS2322: Type 'string' is not assignable to type 'J'.
301
295
!!! error TS2322: 'string' is assignable to the constraint of type 'J', but 'J' could be instantiated with a different subtype of constraint 'string'.
302
-
!!! error TS2322: Type 'string' is not assignable to type 'J'.
303
-
!!! error TS2322: 'string' is assignable to the constraint of type 'J', but 'J' could be instantiated with a different subtype of constraint 'string'.
0 commit comments