@@ -49,30 +49,66 @@ function f2<T extends string | number | undefined, U extends string | null | und
49
49
type T1 = (string | number | undefined) & (string | null | undefined); // string | undefined
50
50
>T1 : Symbol(T1, Decl(intersectionWithUnionConstraint.ts, 12, 1))
51
51
52
+ function f3<T extends string | number | undefined>(x: T & (number | object | undefined)) {
53
+ >f3 : Symbol(f3, Decl(intersectionWithUnionConstraint.ts, 14, 70))
54
+ >T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 16, 12))
55
+ >x : Symbol(x, Decl(intersectionWithUnionConstraint.ts, 16, 51))
56
+ >T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 16, 12))
57
+
58
+ const y: number | undefined = x;
59
+ >y : Symbol(y, Decl(intersectionWithUnionConstraint.ts, 17, 9))
60
+ >x : Symbol(x, Decl(intersectionWithUnionConstraint.ts, 16, 51))
61
+ }
62
+
63
+ function f4<T extends string | number>(x: T & (number | object)) {
64
+ >f4 : Symbol(f4, Decl(intersectionWithUnionConstraint.ts, 18, 1))
65
+ >T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 20, 12))
66
+ >x : Symbol(x, Decl(intersectionWithUnionConstraint.ts, 20, 39))
67
+ >T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 20, 12))
68
+
69
+ const y: number = x;
70
+ >y : Symbol(y, Decl(intersectionWithUnionConstraint.ts, 21, 9))
71
+ >x : Symbol(x, Decl(intersectionWithUnionConstraint.ts, 20, 39))
72
+ }
73
+
74
+ function f5<T, U extends keyof T>(x: keyof T & U) {
75
+ >f5 : Symbol(f5, Decl(intersectionWithUnionConstraint.ts, 22, 1))
76
+ >T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 24, 12))
77
+ >U : Symbol(U, Decl(intersectionWithUnionConstraint.ts, 24, 14))
78
+ >T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 24, 12))
79
+ >x : Symbol(x, Decl(intersectionWithUnionConstraint.ts, 24, 34))
80
+ >T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 24, 12))
81
+ >U : Symbol(U, Decl(intersectionWithUnionConstraint.ts, 24, 14))
82
+
83
+ let y: keyof any = x;
84
+ >y : Symbol(y, Decl(intersectionWithUnionConstraint.ts, 25, 7))
85
+ >x : Symbol(x, Decl(intersectionWithUnionConstraint.ts, 24, 34))
86
+ }
87
+
52
88
// Repro from #23648
53
89
54
90
type Example<T, U> = { [K in keyof T]: K extends keyof U ? UnexpectedError<K> : NoErrorHere<K> }
55
- >Example : Symbol(Example, Decl(intersectionWithUnionConstraint.ts, 14, 70 ))
56
- >T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 18 , 13))
57
- >U : Symbol(U, Decl(intersectionWithUnionConstraint.ts, 18 , 15))
58
- >K : Symbol(K, Decl(intersectionWithUnionConstraint.ts, 18 , 24))
59
- >T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 18 , 13))
60
- >K : Symbol(K, Decl(intersectionWithUnionConstraint.ts, 18 , 24))
61
- >U : Symbol(U, Decl(intersectionWithUnionConstraint.ts, 18 , 15))
62
- >UnexpectedError : Symbol(UnexpectedError, Decl(intersectionWithUnionConstraint.ts, 18 , 96))
63
- >K : Symbol(K, Decl(intersectionWithUnionConstraint.ts, 18 , 24))
64
- >NoErrorHere : Symbol(NoErrorHere, Decl(intersectionWithUnionConstraint.ts, 20 , 47))
65
- >K : Symbol(K, Decl(intersectionWithUnionConstraint.ts, 18 , 24))
91
+ >Example : Symbol(Example, Decl(intersectionWithUnionConstraint.ts, 26, 1 ))
92
+ >T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 30 , 13))
93
+ >U : Symbol(U, Decl(intersectionWithUnionConstraint.ts, 30 , 15))
94
+ >K : Symbol(K, Decl(intersectionWithUnionConstraint.ts, 30 , 24))
95
+ >T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 30 , 13))
96
+ >K : Symbol(K, Decl(intersectionWithUnionConstraint.ts, 30 , 24))
97
+ >U : Symbol(U, Decl(intersectionWithUnionConstraint.ts, 30 , 15))
98
+ >UnexpectedError : Symbol(UnexpectedError, Decl(intersectionWithUnionConstraint.ts, 30 , 96))
99
+ >K : Symbol(K, Decl(intersectionWithUnionConstraint.ts, 30 , 24))
100
+ >NoErrorHere : Symbol(NoErrorHere, Decl(intersectionWithUnionConstraint.ts, 32 , 47))
101
+ >K : Symbol(K, Decl(intersectionWithUnionConstraint.ts, 30 , 24))
66
102
67
103
type UnexpectedError<T extends PropertyKey> = T
68
- >UnexpectedError : Symbol(UnexpectedError, Decl(intersectionWithUnionConstraint.ts, 18 , 96))
69
- >T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 20 , 21))
104
+ >UnexpectedError : Symbol(UnexpectedError, Decl(intersectionWithUnionConstraint.ts, 30 , 96))
105
+ >T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 32 , 21))
70
106
>PropertyKey : Symbol(PropertyKey, Decl(lib.d.ts, --, --))
71
- >T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 20 , 21))
107
+ >T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 32 , 21))
72
108
73
109
type NoErrorHere<T extends PropertyKey> = T
74
- >NoErrorHere : Symbol(NoErrorHere, Decl(intersectionWithUnionConstraint.ts, 20 , 47))
75
- >T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 21 , 17))
110
+ >NoErrorHere : Symbol(NoErrorHere, Decl(intersectionWithUnionConstraint.ts, 32 , 47))
111
+ >T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 33 , 17))
76
112
>PropertyKey : Symbol(PropertyKey, Decl(lib.d.ts, --, --))
77
- >T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 21 , 17))
113
+ >T : Symbol(T, Decl(intersectionWithUnionConstraint.ts, 33 , 17))
78
114
0 commit comments