omitProps()function

omitProps(input: T, ...keys: K[]): Omit<T, K>
ParamType
inputT
The object to remove the props from. required
keysK[]
The keys of the props to remove. required
Return
Omit<T, K>
A new object without the removed props, or the original object if no keys were present.

Remove several props from an object (immutably) and return a new object without those props.

  • If none of the keys exist the original object is returned unchanged.

Examples

omitProps({ a: 1, b: 2, c: 3 }, "b", "c"); // { a: 1 }