Skip to content

override

The override() method replaces the properties of an object with those of another, ignoring undefined values.

Interactive example

Syntax

Classic signature

typescript
function override<
	GenericInput extends object
>(
	input: GenericInput,
	value: Partial<NoInfer<GenericInput>>
): GenericInput

Curried signature

typescript
function override<
	GenericInput extends object
>(
	value: Partial<NoInfer<GenericInput>>
): (input: GenericInput) => GenericInput

Parameters

  • input: The base object.
  • value: A partial object containing the properties to replace.

Return value

A new object with the properties replaced (undefined values are ignored).

See also

  • assign - Merges multiple objects together

Released under the MIT license.