Function deepOverwriteMerge

  • Returns a new object with the properties from overrides deeply merged into target.

    In theory this method could merge any objects together, but it's designed for the common fake data use case of overwriting select properties on a defaulted base object. When target is T and overrides are constrained to DeepPartial<T> then the compiler can easily be convinced that the merged output is of type T.

    If a key exists on both overrides and target then it will be merged if both values are objects, or the overrides value will win if it is a primitive or array.

    Keys with falsy values are preserved in the resulting object.

    This method doesn't support number or Symbol keys.

    Type Parameters

    • T extends Record<string, any>

    Parameters

    Returns T