Utility Types in TypeScript
From the TypeScript cheat sheet ยท Advanced Types ยท verified Jul 2026
Utility Types
Built-in generic types for common type transformations
typescript
Partial<User> // all props optional
Required<User> // all props required
Pick<User, "name" | "email"> // select props
Omit<User, "password"> // exclude props
Record<string, number> // key-value object
Readonly<User> // all props readonly๐ก Pick and Omit are your go-to for creating API response types from full models
โก Record<K, V> is cleaner than { [key: string]: V } for objects with known key types
๐ Exclude/Extract work on union types โ Omit/Pick work on object types
๐ข ReturnType<typeof fn> extracts a function return type without writing it manually