What is the Omit utility type?
Why Interviewers Ask This
Candidates at the intermediate level are expected to not only know this concept but explain the trade-offs involved. Interviewers use this question to see if you can reason about design decisions, not just recall facts.
Answer
Omit<T, K> creates a new type by removing the properties K from type T — the opposite of Pick. Implementation: type Omit<T, K extends keyof any> = Pick<T, Exclude<keyof T, K>>. Example: type CreateUserDto = Omit<User, "id" | "createdAt" | "updatedAt">; — the DTO type has all User properties except the server-generated ones. Another example: type UpdateUserDto = Partial<Omit<User, "id">>; — all User fields except id, all optional. Omit is ideal when you have a large type and only want to exclude a small number of properties. Key difference from Pick: Omit<T, K> where K does not extend keyof T will not produce an error (unlike Pick which is stricter about K extending keyof T). Combining: Omit<T, K1> & Pick<T, K2> for complex selections. Omit is extremely common in TypeScript codebases for creating form types, DTOs, and API shapes.
Pro Tip
Before answering, structure your response: one-line definition → real-world analogy → concrete example from a project. This makes even complex TypeScript answers easy to follow.