• Version 6.0.2
  • Published
  • 35.1 kB
  • 1 dependency
  • MIT license


npm i merge-anything
yarn add merge-anything
pnpm add merge-anything


Merge objects & other types recursively. A simple & small integration.



function concatArrays

concatArrays: <T>(originVal: unknown, newVal: T) => T;

    function merge

    merge: <T, Tn extends unknown[]>(object: T, ...otherObjects: Tn) => Merge<T, Tn>;
    • Merge anything recursively. Objects get merged, special objects (classes etc.) are re-assigned "as is". Basic types overwrite objects or other basic types.

    function mergeAndCompare

    mergeAndCompare: <T, Tn extends unknown[]>(
    compareFn: (prop1: unknown, prop2: unknown, propName: string | symbol) => any,
    object: T,
    ...otherObjects: Tn
    ) => Merge<T, Tn>;

      function mergeAndConcat

      mergeAndConcat: <T, Tn extends unknown[]>(
      object: T,
      ...otherObjects: Tn
      ) => Merge<T, Tn>;

        Type Aliases

        type Merge

        type Merge<T, Ts extends unknown[]> = T extends Record<
        string | number | symbol,
        ? Ts extends Record<string | number | symbol, unknown>[]
        ? PrettyPrint<Assign<T, Ts>>
        : Pop<Ts>
        : Pop<Ts>;
        • The return type of merge(). It reflects the type that is returned by JavaScript.

          This TS Utility can be used as standalone as well

        Package Files (3)

        Dependencies (1)

        Dev Dependencies (5)

        Peer Dependencies (0)

        No peer dependencies.


        To add a badge like this badgeto your package's README, use the codes available below.

        You may also use to create a custom badge linking to

        • Markdown
        • HTML
          <a href=""><img src="" alt=""></a>