Function deepMerge
- deepMerge<T extends object, U extends object, V extends object>(
target: T,
sourceObj1: U,
sourceObj2: V,
): DeepMerge<
{ [K in string
| number
| symbol]: (Omit<T, keyof U> & U)[K] },
[V] extends object[] ? object[] & [V] : [],
>Recursively deep merges all source objects into the target object in place. Like
Object.assign
if you provide{}
as the target a shallow copy is produced. If the target and source property are object literals they are merged.Note: The output type is inferred, but you may provide explicit generic types as well.
Type Parameters
- T extends object
- U extends object
- V extends object
Returns DeepMerge<
{ [K in string
| number
| symbol]: (Omit<T, keyof U> & U)[K] },
[V] extends object[] ? object[] & [V] : [],
>Target object.
Recursively deep merges all source objects into the target object in place. Like
Object.assign
if you provide{}
as the target a shallow copy is produced. If the target and source property are object literals they are merged.Note: The output type is inferred, but you may provide explicit generic types as well.
Type Parameters
- T extends object
- U extends object[]
Returns DeepMerge<T, U>
Target object.
Recursively deep merges all source objects into the target object in place. Like
Object.assign
if you provide{}
as the target a shallow copy is produced. If the target and source property are object literals they are merged.Note: The output type is inferred, but you may provide explicit generic types as well.