Skip to content

deepMerge

deepMerge(target, source): Record<string, unknown>

Defined in: merge.ts:26

Recursively merge source onto target, returning a new object.

  • Plain objects present in both are merged key-by-key (recursively).
  • Arrays, primitives, functions, and class instances replace wholesale.
  • undefined values in source are skipped, so a later source can’t blank out an earlier one by listing a key with no value.

Neither argument is mutated. The result is a fresh object graph for the keys that were merged; replaced leaf values keep their original reference.

Record<string, unknown>

Record<string, unknown>

Record<string, unknown>