@@ -156,3 +156,37 @@ type T0 = MaybeTrue<{ b: never }> // "no"
156
156
type T1 = MaybeTrue < { b : false } > ; // "no"
157
157
type T2 = MaybeTrue < { b : true } > ; // "yes"
158
158
type T3 = MaybeTrue < { b : boolean } > ; // "yes"
159
+
160
+ // Repro from #28824
161
+
162
+ type Union = 'a' | 'b' ;
163
+ type Product < A extends Union , B > = { f1 : A , f2 : B } ;
164
+ type ProductUnion = Product < 'a' , 0 > | Product < 'b' , 1 > ;
165
+
166
+ // {a: "b"; b: "a"}
167
+ type UnionComplement = {
168
+ [ K in Union ] : Exclude < Union , K >
169
+ } ;
170
+ type UCA = UnionComplement [ 'a' ] ;
171
+ type UCB = UnionComplement [ 'b' ] ;
172
+
173
+ // {a: "a"; b: "b"}
174
+ type UnionComplementComplement = {
175
+ [ K in Union ] : Exclude < Union , Exclude < Union , K > >
176
+ } ;
177
+ type UCCA = UnionComplementComplement [ 'a' ] ;
178
+ type UCCB = UnionComplementComplement [ 'b' ] ;
179
+
180
+ // {a: Product<'b', 1>; b: Product<'a', 0>}
181
+ type ProductComplement = {
182
+ [ K in Union ] : Exclude < ProductUnion , { f1 : K } >
183
+ } ;
184
+ type PCA = ProductComplement [ 'a' ] ;
185
+ type PCB = ProductComplement [ 'b' ] ;
186
+
187
+ // {a: Product<'a', 0>; b: Product<'b', 1>}
188
+ type ProductComplementComplement = {
189
+ [ K in Union ] : Exclude < ProductUnion , Exclude < ProductUnion , { f1 : K } > >
190
+ } ;
191
+ type PCCA = ProductComplementComplement [ 'a' ] ;
192
+ type PCCB = ProductComplementComplement [ 'b' ] ;
0 commit comments