- omit<T extends object, K extends string | number | symbol = keyof T>(
object: null | T,
props: K[],
): T extends null ? { [key: string]: never } : Omit<T, K> Type Parameters
- T extends object
- K extends string | number | symbol = keyof T
Parameters
- object: null | T
- props: K[]
Returns T extends null ? { [key: string]: never } : Omit<T, K>
- new object without given properties
Returns a cloned source object but without specified properties.
TypeScript tip: if you want to omit properties that TS think does not exist in the object, call the function like that:
Example
Example