Skip to content

omit ​

The omit() method creates a new object by excluding certain properties.

Interactive example ​

Syntax ​

Classic signature ​

typescript
function omit<
	GenericInput extends object,
	GenericOmitValue extends Partial<Record<keyof GenericInput, boolean>> | readonly (keyof GenericInput)[]
>(
	input: GenericInput,
	omitValue: GenericOmitValue
): SimplifyTopLevel<Omit<GenericInput, ...>>

Curried signature ​

typescript
function omit<
	GenericInput extends object,
	GenericOmitValue extends Partial<Record<keyof GenericInput, boolean>> | readonly (keyof GenericInput)[]
>(
	omitValue: GenericOmitValue
): (input: GenericInput) => SimplifyTopLevel<Omit<GenericInput, ...>>

Parameters ​

  • input: The source object.
  • omitValue: The keys to exclude (array of keys or object with boolean values).

Return value ​

A new object without the excluded properties.

See also ​

  • pick - Creates an object by selecting certain properties

Released under the MIT license.