Function deepMerge

    • 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

      Parameters

      • target: T

        Target object.

      • sourceObj: U

        One or more source objects.

      Returns { [K in string | number | symbol]: (Omit<T, keyof U> & U)[K] }

      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
      • V extends object

      Parameters

      • target: T

        Target object.

      • sourceObj1: U
      • sourceObj2: V

      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[]

      Parameters

      • target: T

        Target object.

      • ...sourceObj: U

        One or more source objects.

      Returns DeepMerge<T, U>

      Target object.