Utility Omit
Question
What does Omit<T, K> do?
Hint
Omit<T, K> = Pick<T, Exclude<keyof T, K>>.
Explanation
Omit<T, K> creates a new type by removing the properties listed in K. type User = { name: string; age: number; email: string }. type PublicUser = Omit<User, "email"> results in { name: string; age: number }. Useful for creating public-facing types that exclude sensitive fields. Omit is implemented as Pick<T, Exclude<keyof T, K>>. Related: Record<K, T> creates an object type with keys K and values T.
Related Resources
Related Lessons
- Utility Types
Learn utility types.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.