@@ -92,3 +92,157 @@ let x14: A & B & C & D & E;
92
92
>D : Symbol(D, Decl(intersectionsAndEmptyObjects.ts, 15, 39))
93
93
>E : Symbol(E, Decl(intersectionsAndEmptyObjects.ts, 17, 14))
94
94
95
+ // Repro from #20225
96
+
97
+ type Dictionary = { [name: string]: string };
98
+ >Dictionary : Symbol(Dictionary, Decl(intersectionsAndEmptyObjects.ts, 24, 27))
99
+ >name : Symbol(name, Decl(intersectionsAndEmptyObjects.ts, 28, 21))
100
+
101
+ const intersectDictionaries = <F1 extends Dictionary, F2 extends Dictionary>(
102
+ >intersectDictionaries : Symbol(intersectDictionaries, Decl(intersectionsAndEmptyObjects.ts, 30, 5))
103
+ >F1 : Symbol(F1, Decl(intersectionsAndEmptyObjects.ts, 30, 31))
104
+ >Dictionary : Symbol(Dictionary, Decl(intersectionsAndEmptyObjects.ts, 24, 27))
105
+ >F2 : Symbol(F2, Decl(intersectionsAndEmptyObjects.ts, 30, 53))
106
+ >Dictionary : Symbol(Dictionary, Decl(intersectionsAndEmptyObjects.ts, 24, 27))
107
+
108
+ d1: F1,
109
+ >d1 : Symbol(d1, Decl(intersectionsAndEmptyObjects.ts, 30, 77))
110
+ >F1 : Symbol(F1, Decl(intersectionsAndEmptyObjects.ts, 30, 31))
111
+
112
+ d2: F2,
113
+ >d2 : Symbol(d2, Decl(intersectionsAndEmptyObjects.ts, 31, 9))
114
+ >F2 : Symbol(F2, Decl(intersectionsAndEmptyObjects.ts, 30, 53))
115
+
116
+ ): F1 & F2 => Object.assign({}, d1, d2);
117
+ >F1 : Symbol(F1, Decl(intersectionsAndEmptyObjects.ts, 30, 31))
118
+ >F2 : Symbol(F2, Decl(intersectionsAndEmptyObjects.ts, 30, 53))
119
+ >Object.assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
120
+ >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
121
+ >assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
122
+ >d1 : Symbol(d1, Decl(intersectionsAndEmptyObjects.ts, 30, 77))
123
+ >d2 : Symbol(d2, Decl(intersectionsAndEmptyObjects.ts, 31, 9))
124
+
125
+ const testDictionary = <T extends Dictionary>(_value: T) => { };
126
+ >testDictionary : Symbol(testDictionary, Decl(intersectionsAndEmptyObjects.ts, 35, 5))
127
+ >T : Symbol(T, Decl(intersectionsAndEmptyObjects.ts, 35, 24))
128
+ >Dictionary : Symbol(Dictionary, Decl(intersectionsAndEmptyObjects.ts, 24, 27))
129
+ >_value : Symbol(_value, Decl(intersectionsAndEmptyObjects.ts, 35, 46))
130
+ >T : Symbol(T, Decl(intersectionsAndEmptyObjects.ts, 35, 24))
131
+
132
+ const d1 = {};
133
+ >d1 : Symbol(d1, Decl(intersectionsAndEmptyObjects.ts, 37, 5))
134
+
135
+ testDictionary(d1);
136
+ >testDictionary : Symbol(testDictionary, Decl(intersectionsAndEmptyObjects.ts, 35, 5))
137
+ >d1 : Symbol(d1, Decl(intersectionsAndEmptyObjects.ts, 37, 5))
138
+
139
+ const d2 = intersectDictionaries(d1, d1);
140
+ >d2 : Symbol(d2, Decl(intersectionsAndEmptyObjects.ts, 39, 5))
141
+ >intersectDictionaries : Symbol(intersectDictionaries, Decl(intersectionsAndEmptyObjects.ts, 30, 5))
142
+ >d1 : Symbol(d1, Decl(intersectionsAndEmptyObjects.ts, 37, 5))
143
+ >d1 : Symbol(d1, Decl(intersectionsAndEmptyObjects.ts, 37, 5))
144
+
145
+ testDictionary(d2);
146
+ >testDictionary : Symbol(testDictionary, Decl(intersectionsAndEmptyObjects.ts, 35, 5))
147
+ >d2 : Symbol(d2, Decl(intersectionsAndEmptyObjects.ts, 39, 5))
148
+
149
+ const d3 = {
150
+ >d3 : Symbol(d3, Decl(intersectionsAndEmptyObjects.ts, 42, 5))
151
+
152
+ s: '',
153
+ >s : Symbol(s, Decl(intersectionsAndEmptyObjects.ts, 42, 12))
154
+
155
+ };
156
+ testDictionary(d3);
157
+ >testDictionary : Symbol(testDictionary, Decl(intersectionsAndEmptyObjects.ts, 35, 5))
158
+ >d3 : Symbol(d3, Decl(intersectionsAndEmptyObjects.ts, 42, 5))
159
+
160
+ const d4 = intersectDictionaries(d1, d3);
161
+ >d4 : Symbol(d4, Decl(intersectionsAndEmptyObjects.ts, 46, 5))
162
+ >intersectDictionaries : Symbol(intersectDictionaries, Decl(intersectionsAndEmptyObjects.ts, 30, 5))
163
+ >d1 : Symbol(d1, Decl(intersectionsAndEmptyObjects.ts, 37, 5))
164
+ >d3 : Symbol(d3, Decl(intersectionsAndEmptyObjects.ts, 42, 5))
165
+
166
+ testDictionary(d4);
167
+ >testDictionary : Symbol(testDictionary, Decl(intersectionsAndEmptyObjects.ts, 35, 5))
168
+ >d4 : Symbol(d4, Decl(intersectionsAndEmptyObjects.ts, 46, 5))
169
+
170
+ const d5 = intersectDictionaries(d3, d1);
171
+ >d5 : Symbol(d5, Decl(intersectionsAndEmptyObjects.ts, 48, 5))
172
+ >intersectDictionaries : Symbol(intersectDictionaries, Decl(intersectionsAndEmptyObjects.ts, 30, 5))
173
+ >d3 : Symbol(d3, Decl(intersectionsAndEmptyObjects.ts, 42, 5))
174
+ >d1 : Symbol(d1, Decl(intersectionsAndEmptyObjects.ts, 37, 5))
175
+
176
+ testDictionary(d5);
177
+ >testDictionary : Symbol(testDictionary, Decl(intersectionsAndEmptyObjects.ts, 35, 5))
178
+ >d5 : Symbol(d5, Decl(intersectionsAndEmptyObjects.ts, 48, 5))
179
+
180
+ const d6 = intersectDictionaries(d3, d3);
181
+ >d6 : Symbol(d6, Decl(intersectionsAndEmptyObjects.ts, 50, 5))
182
+ >intersectDictionaries : Symbol(intersectDictionaries, Decl(intersectionsAndEmptyObjects.ts, 30, 5))
183
+ >d3 : Symbol(d3, Decl(intersectionsAndEmptyObjects.ts, 42, 5))
184
+ >d3 : Symbol(d3, Decl(intersectionsAndEmptyObjects.ts, 42, 5))
185
+
186
+ testDictionary(d6);
187
+ >testDictionary : Symbol(testDictionary, Decl(intersectionsAndEmptyObjects.ts, 35, 5))
188
+ >d6 : Symbol(d6, Decl(intersectionsAndEmptyObjects.ts, 50, 5))
189
+
190
+ // Repro from #27044
191
+
192
+ type choices<IChoiceList extends {
193
+ >choices : Symbol(choices, Decl(intersectionsAndEmptyObjects.ts, 51, 19))
194
+ >IChoiceList : Symbol(IChoiceList, Decl(intersectionsAndEmptyObjects.ts, 55, 13))
195
+
196
+ [key: string]: boolean;
197
+ >key : Symbol(key, Decl(intersectionsAndEmptyObjects.ts, 56, 5))
198
+
199
+ }> = IChoiceList & {
200
+ >IChoiceList : Symbol(IChoiceList, Decl(intersectionsAndEmptyObjects.ts, 55, 13))
201
+
202
+ shoes:boolean;
203
+ >shoes : Symbol(shoes, Decl(intersectionsAndEmptyObjects.ts, 57, 20))
204
+
205
+ food:boolean;
206
+ >food : Symbol(food, Decl(intersectionsAndEmptyObjects.ts, 58, 18))
207
+
208
+ };
209
+
210
+ type IMyChoiceList = {
211
+ >IMyChoiceList : Symbol(IMyChoiceList, Decl(intersectionsAndEmptyObjects.ts, 60, 2))
212
+
213
+ car: true
214
+ >car : Symbol(car, Decl(intersectionsAndEmptyObjects.ts, 62, 22))
215
+
216
+ };
217
+
218
+ type IUnknownChoiceList = {};
219
+ >IUnknownChoiceList : Symbol(IUnknownChoiceList, Decl(intersectionsAndEmptyObjects.ts, 64, 2))
220
+
221
+ var defaultChoices: choices<{}>;
222
+ >defaultChoices : Symbol(defaultChoices, Decl(intersectionsAndEmptyObjects.ts, 68, 3))
223
+ >choices : Symbol(choices, Decl(intersectionsAndEmptyObjects.ts, 51, 19))
224
+
225
+ var defaultChoicesAndEmpty: choices<{} & {}>;
226
+ >defaultChoicesAndEmpty : Symbol(defaultChoicesAndEmpty, Decl(intersectionsAndEmptyObjects.ts, 69, 3))
227
+ >choices : Symbol(choices, Decl(intersectionsAndEmptyObjects.ts, 51, 19))
228
+
229
+ var myChoices: choices<IMyChoiceList>;
230
+ >myChoices : Symbol(myChoices, Decl(intersectionsAndEmptyObjects.ts, 71, 3))
231
+ >choices : Symbol(choices, Decl(intersectionsAndEmptyObjects.ts, 51, 19))
232
+ >IMyChoiceList : Symbol(IMyChoiceList, Decl(intersectionsAndEmptyObjects.ts, 60, 2))
233
+
234
+ var myChoicesAndEmpty: choices<IMyChoiceList & {}>;
235
+ >myChoicesAndEmpty : Symbol(myChoicesAndEmpty, Decl(intersectionsAndEmptyObjects.ts, 72, 3))
236
+ >choices : Symbol(choices, Decl(intersectionsAndEmptyObjects.ts, 51, 19))
237
+ >IMyChoiceList : Symbol(IMyChoiceList, Decl(intersectionsAndEmptyObjects.ts, 60, 2))
238
+
239
+ var unknownChoices: choices<IUnknownChoiceList>;
240
+ >unknownChoices : Symbol(unknownChoices, Decl(intersectionsAndEmptyObjects.ts, 74, 3))
241
+ >choices : Symbol(choices, Decl(intersectionsAndEmptyObjects.ts, 51, 19))
242
+ >IUnknownChoiceList : Symbol(IUnknownChoiceList, Decl(intersectionsAndEmptyObjects.ts, 64, 2))
243
+
244
+ var unknownChoicesAndEmpty: choices<IUnknownChoiceList & {}>;
245
+ >unknownChoicesAndEmpty : Symbol(unknownChoicesAndEmpty, Decl(intersectionsAndEmptyObjects.ts, 75, 3))
246
+ >choices : Symbol(choices, Decl(intersectionsAndEmptyObjects.ts, 51, 19))
247
+ >IUnknownChoiceList : Symbol(IUnknownChoiceList, Decl(intersectionsAndEmptyObjects.ts, 64, 2))
248
+
0 commit comments