Skip to main content

Function: omitKeysFromObject()

omitKeysFromObject<Object, ObjectKeys>(source: Object, ...keys: readonly ObjectKeys[]): Omit<Object, ObjectKeys>

Clones the source object using deepClone then deletes the specified keys with Reflect.deleteProperty

Type parameters

Type parameterDescription
Object extends objectThe object type.
ObjectKeys extends string | number | symbolThe keys of the object type.

Parameters

ParameterTypeDescription
sourceObjectThe input object.
...keysreadonly ObjectKeys[]The keys to omit from the object.

Returns

Omit<Object, ObjectKeys>

A new object without the specified keys.

Source

lib/omitKeysFromObject.ts:13