🔧developer

TypeScript Utility Types: Partial, Pick, Omit, and 8 More You'll Actually Use

TypeScript ships with powerful built-in utility types that most developers underuse. Here's a practical guide to the ones that solve real daily problems.

7 min readDecember 1, 2025By FreeToolKit TeamFree to read

TypeScript's utility types are generic types built into the language for transforming existing types. Most developers know Partial and Readonly. Fewer know Record, Exclude, and ReturnType — and those are often the ones that save the most code.

Partial<T>

Makes all properties of T optional. Most useful for update functions where you only want to specify the fields being changed: `function updateUser(id: string, updates: Partial<User>)`. Without Partial, you'd have to manually define a separate type with every field optional.

Required<T>

The inverse — makes all optional properties required. Useful when you have a type with optional fields in general use but need a version where everything must be present (like after validation).

Pick<T, K>

Creates a type with only the specified keys from T. `Pick<User, 'id' | 'email'>` gives you a type with just `id` and `email`. Useful for API responses where you don't want to expose all fields of an internal type.

Omit<T, K>

The inverse of Pick — creates a type with everything except the specified keys. `Omit<User, 'passwordHash'>` is a common pattern for creating public-facing versions of types with sensitive fields removed.

Record<K, V>

Creates an object type with keys of type K and values of type V. `Record<string, number>` is a dictionary. `Record<UserId, User>` creates a lookup map. Far cleaner than `{ [key: string]: number }` and allows narrower key types.

ReturnType<T>

Extracts the return type of a function. Useful when you want the type of whatever a function returns without duplicating the type definition. If the function's return type changes, ReturnType picks it up automatically.

Exclude<T, U> and Extract<T, U>

Exclude removes members of a union type: `Exclude<'a' | 'b' | 'c', 'a'>` gives `'b' | 'c'`. Extract keeps only the specified members. Both are most useful when working with union types and you need variants of them for different contexts.

NonNullable<T>

Removes null and undefined from a type. `NonNullable<string | null | undefined>` gives `string`. Most useful after null checks when you've already verified the value exists and want to communicate that to the type system.

Composition tip

You can chain utility types: `Partial<Omit<User, 'id'>>` creates a type where all fields except id are optional. This is cleaner than creating a new type definition and automatically stays in sync when User changes.

🔧 Free Tools Used in This Guide

FT

FreeToolKit Team

FreeToolKit Team

We build free browser tools and write about the tools developers actually use.

Tags:

typescriptutility typesweb developmentjavascript