Skip to content

Commit 5874691

Browse files
committed
style(Merge-Deep): lint #1208
1 parent 22b0e18 commit 5874691

File tree

2 files changed

+17
-22
lines changed

2 files changed

+17
-22
lines changed

source/merge-deep.d.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ type DoMergeDeepRecord<
6666
// Case in rule 3: Both the source and the destination contain the key.
6767
& {
6868
[Key in keyof Source as Key extends keyof Destination ? Key : never]:
69-
MergeDeepRecordProperty<
70-
Destination[Key],
71-
Source[Key],
72-
Options
73-
>
69+
MergeDeepRecordProperty<
70+
Destination[Key],
71+
Source[Key],
72+
Options
73+
>
7474
};
7575

7676
/**

test-d/merge-deep.ts

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,6 @@ expectType<MergedFooBar>(mergedFooBar);
188188
declare const mergedBarFoo: MergeDeep<FooOptional, BarOptional>;
189189
expectType<MergedFooBar>(mergedBarFoo);
190190

191-
192-
193191
// Nested Optional: Ensuringing the merge goes deep
194192
type OptionalNestedTest = {
195193
Left: {
@@ -215,10 +213,10 @@ type OptionalNestedRightIntoLeft = MergeDeep<
215213
OptionalNestedTest['Right']
216214
>;
217215
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
220218
in_right: string;
221-
sub_nested: { // Optional is ovewritten by Right in subentries
219+
sub_nested: { // Optional is ovewritten by Right in subentries
222220
number: number;
223221
};
224222
};
@@ -229,16 +227,15 @@ type OptionalNestedLeftIntoRight = MergeDeep<
229227
OptionalNestedTest['Left']
230228
>;
231229
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
234232
in_right: string;
235-
sub_nested?: { // Optional is added by Left in subentries
233+
sub_nested?: { // Optional is added by Left in subentries
236234
number?: number;
237235
};
238236
};
239237
}>();
240238

241-
242239
// Nested Optional: Optional versus undefined entry
243240
type OptionalOrUndefinedNestedTest = {
244241
Left: {
@@ -258,24 +255,23 @@ type OptionalOrUndefinedNestedRightIntoLeft = MergeDeep<
258255
OptionalOrUndefinedNestedTest['Right']
259256
>;
260257
expectTypeOf<OptionalOrUndefinedNestedRightIntoLeft>().toEqualTypeOf<{
261-
nested: { // ? is ovewritten by Right
258+
nested: { // ? is ovewritten by Right
262259
string: string;
263260
number: number;
264-
} | undefined; // Undefined is kept in both directions
261+
} | undefined; // Undefined is kept in both directions
265262
}>();
266263

267264
type OptionalOrUndefinedNestedRightIntoRight = MergeDeep<
268265
OptionalOrUndefinedNestedTest['Right'],
269266
OptionalOrUndefinedNestedTest['Left']
270267
>;
271268
expectTypeOf<OptionalOrUndefinedNestedRightIntoRight>().toEqualTypeOf<{
272-
nested?: { // ? is added by Left
269+
nested?: { // ? is added by Left
273270
string: string;
274271
number: number;
275-
} | undefined; // Undefined is kept in both directions
272+
} | undefined; // Undefined is kept in both directions
276273
}>();
277274

278-
279275
// Nested Optional: Optional versus undefined entry
280276
type OptionalAndUndefinedNestedTest = {
281277
Left: {
@@ -298,7 +294,7 @@ expectTypeOf<OptionalAndUndefinedNestedRightIntoLeft>().toEqualTypeOf<{
298294
nested: {
299295
in_left: string;
300296
in_right: string;
301-
} // Undefined is overwritten by Right
297+
}; // Undefined is overwritten by Right
302298
// | undefined;
303299
// TODO Should we preserve the "| undefined" there?
304300
}>();
@@ -311,11 +307,10 @@ expectTypeOf<OptionalAndUndefinedNestedRightIntoRight>().toEqualTypeOf<{
311307
nested?: {
312308
in_left: string;
313309
in_right: string;
314-
}; // Undefined is not kept as redundant
310+
}; // Undefined is not kept as redundant
315311
// TODO is there a way to force the undefined to be there? Should we?
316312
}>();
317313

318-
319314
// Test for readonly
320315
type ReadonlyFoo = {
321316
readonly string: string;

0 commit comments

Comments
 (0)