omit function
Omit specific properties from an object.
Example
const user = { id: "1", name: "John", password: "secret" };
const safe = omit(user, "password");Signature
omit<T extends Record<string, any>, K extends string | number | symbol>(obj: T, ...keys: K[]): Omit<T, K>
Type Parameters
- T
Object type
- K
Keys to omit
Parameters
- obj
Source object
- keys
Property names to exclude
Returns
New object without the omitted properties