Skip to main content

Interface: SafeObjectOmit()

Defined in: shared/utils/objectSafety.ts:139

Create a type-safe object with specified keys omitted.

Exampleโ€‹

const user = {
id: 1,
name: "John",
email: "john@example.com",
password: "secret",
};
const publicUser = safeObjectOmit(user, ["password"]);
// Type: { id: number; name: string; email: string; }

Paramโ€‹

Source object

Paramโ€‹

Keys to omit from the object

Call Signatureโ€‹

SafeObjectOmit(obj: null | undefined, keys: readonly PropertyKey[]): Record<string, never>

Defined in: shared/utils/objectSafety.ts:143

Omitting keys from a nullish input yields an empty object.

Parametersโ€‹

objโ€‹

null | undefined

keysโ€‹

readonly PropertyKey[]

Returnsโ€‹

Record<string, never>

Call Signatureโ€‹

SafeObjectOmit<T, K>(obj: T | null | undefined, keys: readonly K[]): Omit<T, K>

Defined in: shared/utils/objectSafety.ts:151

Omits the provided keys from the object.

Type Parametersโ€‹

Tโ€‹

T extends object

Kโ€‹

K extends string | number | symbol

Parametersโ€‹

objโ€‹

T | null | undefined

keysโ€‹

readonly K[]

Returnsโ€‹

Omit<T, K>