Which built-in utility types do you use most?
Utility types transform existing types so you do not repeat yourself.
Partial<T>: all properties optional (patch payloads, form drafts).Required<T>: all properties required.Readonly<T>: all properties readonly (props, frozen config).Pick<T, 'a' | 'b'>andOmit<T, 'password'>: choose or drop properties (public DTOs, wrapper props).Record<K, V>: an object with keysKand valuesV(lookup tables).Exclude<U, X>,Extract<U, X>: filter members of a union.NonNullable<T>: removenullandundefined.ReturnType<typeof fn>,Parameters<typeof fn>: types derived from functions.Awaited<T>: the resolved type of a promise.- React:
React.ComponentProps<typeof Button>orComponentProps<'button'>to reuse another component's or element's props.
Why it matters
Deriving types keeps them in sync: when User gets a new field, Partial<User> and Omit<User, 'password'> update automatically.
Example
ts
interface User { id: string; name: string; email: string; password: string; }
type PublicUser = Omit<User, 'password'>;
type UserPatch = Partial<Pick<User, 'name' | 'email'>>;
type Role = 'admin' | 'editor' | 'viewer';
const labels: Record<Role, string> = { admin: 'Admin', editor: 'Editor', viewer: 'Viewer' };
async function loadUser() { return { id: '1', name: 'A' }; }
type Loaded = Awaited<ReturnType<typeof loadUser>>; // { id: string; name: string }
type NativeButton = React.ComponentProps<'button'>;
type MyButtonProps = NativeButton & { variant: 'primary' | 'ghost' };Follow-up questions interviewers ask
Try answering each one before you open it.
How is Omit implemented?
type Omit<T, K extends keyof any> = Pick<T, Exclude<keyof T, K>>; It takes all keys of T, removes K with Exclude, and picks what is left. Note that Omit on a union type is not distributive; write a distributive version with a conditional type if you need one per variant.