Saltar al contenido principal

Function: useOmit()

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

Defined in: src/core/services/utils.service.ts:204

Omits the listed keys from an object, returning a shallow copy without them. Shallow on purpose to avoid structuredClone failures on non-cloneable values.

Type Parameters

T

T extends object

Source object type.

K

K extends string | number | symbol

Keys to omit.

Parameters

obj

T

The source object.

keys

K[]

Array of keys to exclude.

Returns

Omit<T, K>

A new object without the omitted keys.

Example

const user = { id: 1, name: "Alice", password: "secret" };
useOmit(user, ["password"]); // { id: 1, name: "Alice" }