Skip to content

Commit

Permalink
fix: get type from inner customMerge function
Browse files Browse the repository at this point in the history
  • Loading branch information
Rebecca Stevens committed Nov 9, 2020
1 parent 80ce4bc commit 0c306df
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,28 @@ type DeepMergeObjectProps<
T2,
Options extends deepmerge.Options
> = {} extends {
[K in keyof (T1 & T2)]: Options["customMerge"] extends undefined
? DeepMerge<ValueOfKey<T1, K>, ValueOfKey<T2, K>, Options>
: ReturnType<NonNullable<Options["customMerge"]>>;
[K in keyof (T1 & T2)]: any;
}
? {
[K in keyof T1]: Options["customMerge"] extends undefined
? DeepMerge<ValueOfKey<T1, K>, ValueOfKey<T2, K>, Options>
: ReturnType<NonNullable<Options["customMerge"]>>;
: ReturnType<NonNullable<Options["customMerge"]>> extends undefined
? DeepMerge<ValueOfKey<T1, K>, ValueOfKey<T2, K>, Options>
: ReturnType<NonNullable<ReturnType<NonNullable<Options["customMerge"]>>>>;
} &
{
[K in keyof T2]: Options["customMerge"] extends undefined
? DeepMerge<ValueOfKey<T1, K>, ValueOfKey<T2, K>, Options>
: ReturnType<NonNullable<Options["customMerge"]>>;
: ReturnType<NonNullable<Options["customMerge"]>> extends undefined
? DeepMerge<ValueOfKey<T1, K>, ValueOfKey<T2, K>, Options>
: ReturnType<NonNullable<ReturnType<NonNullable<Options["customMerge"]>>>>;
}
: {
[K in keyof (T1 & T2)]: Options["customMerge"] extends undefined
? DeepMerge<ValueOfKey<T1, K>, ValueOfKey<T2, K>, Options>
: ReturnType<NonNullable<Options["customMerge"]>>;
: ReturnType<NonNullable<Options["customMerge"]>> extends undefined
? DeepMerge<ValueOfKey<T1, K>, ValueOfKey<T2, K>, Options>
: ReturnType<NonNullable<ReturnType<NonNullable<Options["customMerge"]>>>>;
};

type DeepMergeArrays<
Expand Down

0 comments on commit 0c306df

Please sign in to comment.