Type alias Merge<Object1, Object2>

Merge<Object1, Object2>: Omit<Object1, keyof Object2> & Object2

Merges two object types into new type

Type Parameters

  • Object1

    Object to merge into

  • Object2

    Object to merge and override keys from Object1

Returns

New object type with keys from Object1 and Object2. If a key exists in both Object1 and Object2, the key from Object2 will be used.

Example

type Result = Merge<{ foo: string }, { foo: number; bar: string }>
// ^? type Result = { foo: number; bar: string }

Generated using TypeDoc