midTypeScript
What is the 'Omit' utility type and how is it implemented?
Updated May 4, 2026
Short answer
Omit<T, K> creates a new type by picking all properties from T and then removing those specified in K.
Deep explanation
Omit is the logical opposite of Pick. It is implemented by combining Pick and Exclude. It 'picks' all keys of T except those that are assignable to K. This is extremely useful when you want to use an existing interface but need to remove certain sensitive or irrelevant fields for a specific component or API response.
Real-world example
Defining a React component's props by omitting 'children' from a standard HTML element's attributes.
Common mistakes
- Passing a key to `Omit` that doesn't actually exist in the original interface
- while TS allows this, it often indicates a typo or outdated code.
Follow-up questions
- What is the difference between Omit and Exclude?