Skip to content

Function: omit()

omit<T, K>(obj, keys): Omit<T, K>

Defined in: object.ts:85

Returns a new object with the specified properties removed.

Type Parameters

T

T extends object

K

K extends string | number | symbol

Parameters

obj

T

The source object.

keys

K[]

The property names to exclude.

Returns

Omit<T, K>

A new object without the omitted properties.

Example

ts
omit({ a: 1, b: 2, c: 3 }, ['b'])  // { a: 1, c: 3 }