shallowMerge

creates new object and copies to the one property descriptors of all source objects. In case of name-conflict last source wins.

Import

import { shallowMerge } from 'true-di/utils';
const { shallowMerge } = require('true-di/utils');

Declaration

function shallowMerge(...sourceObject: object[]): object

Actually shallowMerge is well-typed up to 15 source objects. See code source.

Arguments

  • sourceObjects: object[] - objects to be merged in new objects.

Returns

  • new object

Types

export type Merge<T1 extends object, T2 extends object> =
  Omit<T1, keyof T2> & T2; // Overriding Join

Example

Last updated

Was this helpful?