Skip to content

omit()

omit<T>(object, keys): Partial<T>

Defined in: src/utils/objectUtils.ts:118

Omits specified keys from an object.

Type Parameters

T extends Record<string, unknown>

Parameters

object

T

The object to omit properties from.

keys

keyof T[]

The keys to omit.

Returns

Partial<T>

A new object excluding the specified keys.

Example

tsx
const obj = { a: 1, b: 2, c: 3 };
const omitted = omit(obj, ['b']);
console.log(omitted); // { a: 1, c: 3 }

Released under the MIT License.