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

More TypeScript tasks

Back to the full TypeScript cheat sheet