TypeScript·Intermediate·Coding·1 min read
What is the practical benefit of Pick and Omit over hand-written types?
Short interview answer
They derive a new type directly from an existing one, so when the source type gains, removes, or renames a field, the derived type updates automatically at compile time instead of silently drifting out of sync with a manually duplicated definition.
Example
interface User { id: string; name: string; email: string; passwordHash: string }
type PublicUser = Omit<User, 'passwordHash'>;type Credentials = Pick<User, 'email' | 'passwordHash'>;Key takeaway
Explain the underlying mental model clearly, then support it with a concrete example and its trade-offs.