@@ -188,8 +188,6 @@ expectType<MergedFooBar>(mergedFooBar);
188
188
declare const mergedBarFoo : MergeDeep < FooOptional , BarOptional > ;
189
189
expectType < MergedFooBar > ( mergedBarFoo ) ;
190
190
191
-
192
-
193
191
// Nested Optional: Ensuringing the merge goes deep
194
192
type OptionalNestedTest = {
195
193
Left : {
@@ -215,10 +213,10 @@ type OptionalNestedRightIntoLeft = MergeDeep<
215
213
OptionalNestedTest [ 'Right' ]
216
214
> ;
217
215
expectTypeOf < OptionalNestedRightIntoLeft > ( ) . toEqualTypeOf < {
218
- nested : { // Optional is ovewritten by Right
219
- in_left : string ; // Subentries are kept in both directions
216
+ nested : { // Optional is ovewritten by Right
217
+ in_left : string ; // Subentries are kept in both directions
220
218
in_right : string ;
221
- sub_nested : { // Optional is ovewritten by Right in subentries
219
+ sub_nested : { // Optional is ovewritten by Right in subentries
222
220
number : number ;
223
221
} ;
224
222
} ;
@@ -229,16 +227,15 @@ type OptionalNestedLeftIntoRight = MergeDeep<
229
227
OptionalNestedTest [ 'Left' ]
230
228
> ;
231
229
expectTypeOf < OptionalNestedLeftIntoRight > ( ) . toEqualTypeOf < {
232
- nested ?: { // Optional is added by Left
233
- in_left : string ; // Subentries are kept in both directions
230
+ nested ?: { // Optional is added by Left
231
+ in_left : string ; // Subentries are kept in both directions
234
232
in_right : string ;
235
- sub_nested ?: { // Optional is added by Left in subentries
233
+ sub_nested ?: { // Optional is added by Left in subentries
236
234
number ?: number ;
237
235
} ;
238
236
} ;
239
237
} > ( ) ;
240
238
241
-
242
239
// Nested Optional: Optional versus undefined entry
243
240
type OptionalOrUndefinedNestedTest = {
244
241
Left : {
@@ -258,24 +255,23 @@ type OptionalOrUndefinedNestedRightIntoLeft = MergeDeep<
258
255
OptionalOrUndefinedNestedTest [ 'Right' ]
259
256
> ;
260
257
expectTypeOf < OptionalOrUndefinedNestedRightIntoLeft > ( ) . toEqualTypeOf < {
261
- nested : { // ? is ovewritten by Right
258
+ nested : { // ? is ovewritten by Right
262
259
string : string ;
263
260
number : number ;
264
- } | undefined ; // Undefined is kept in both directions
261
+ } | undefined ; // Undefined is kept in both directions
265
262
} > ( ) ;
266
263
267
264
type OptionalOrUndefinedNestedRightIntoRight = MergeDeep <
268
265
OptionalOrUndefinedNestedTest [ 'Right' ] ,
269
266
OptionalOrUndefinedNestedTest [ 'Left' ]
270
267
> ;
271
268
expectTypeOf < OptionalOrUndefinedNestedRightIntoRight > ( ) . toEqualTypeOf < {
272
- nested ?: { // ? is added by Left
269
+ nested ?: { // ? is added by Left
273
270
string : string ;
274
271
number : number ;
275
- } | undefined ; // Undefined is kept in both directions
272
+ } | undefined ; // Undefined is kept in both directions
276
273
} > ( ) ;
277
274
278
-
279
275
// Nested Optional: Optional versus undefined entry
280
276
type OptionalAndUndefinedNestedTest = {
281
277
Left : {
@@ -298,7 +294,7 @@ expectTypeOf<OptionalAndUndefinedNestedRightIntoLeft>().toEqualTypeOf<{
298
294
nested : {
299
295
in_left : string ;
300
296
in_right : string ;
301
- } // Undefined is overwritten by Right
297
+ } ; // Undefined is overwritten by Right
302
298
// | undefined;
303
299
// TODO Should we preserve the "| undefined" there?
304
300
} > ( ) ;
@@ -311,11 +307,10 @@ expectTypeOf<OptionalAndUndefinedNestedRightIntoRight>().toEqualTypeOf<{
311
307
nested ?: {
312
308
in_left : string ;
313
309
in_right : string ;
314
- } ; // Undefined is not kept as redundant
310
+ } ; // Undefined is not kept as redundant
315
311
// TODO is there a way to force the undefined to be there? Should we?
316
312
} > ( ) ;
317
313
318
-
319
314
// Test for readonly
320
315
type ReadonlyFoo = {
321
316
readonly string : string ;
0 commit comments