Function: safeObjectOmit()
safeObjectOmit<
T,K>(obj:T|null|undefined,keys: readonlyK[]):Omit<T,K>
Defined in: shared/utils/objectSafety.ts:121
Create a type-safe object with specified keys omitted.
Type Parametersโ
Tโ
T extends Record<PropertyKey, unknown>
Kโ
K extends string | number | symbol
Parametersโ
objโ
Source object
T | null | undefined
keysโ
readonly K[]
Keys to omit from the object
Returnsโ
Omit<T, K>
New object without the specified keys
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; }