Utility Types Cheat Sheet
Every built-in TypeScript 6 utility type with a one-line definition, a worked example and the case where it misleads you, from Partial and Pick to Awaited.

TypeScript ships a set of generic helper types that transform one type into another, so you can derive a type instead of writing it a second time. This utility types cheat sheet lists the built-in ones in TypeScript 6.x, shows what each produces, and names the case where each one misleads. The behavior is identical in the native TypeScript 7 compiler. The official list is the handbook's utility types page.
All examples use this type.
interface User {
id: number;
name: string;
email?: string;
role: "admin" | "member";
}Property modifiers
| Utility | What it does |
|---|---|
Partial<T> | Makes every property optional |
Required<T> | Makes every property required, removing ? |
Readonly<T> | Makes every property readonly |
interface User {
id: number;
name: string;
email?: string;
}
type Patch = Partial<User>;
type Complete = Required<User>;
type Frozen = Readonly<User>;
const patch: Patch = { name: "Ada" };
const full: Complete = { id: 1, name: "Ada", email: "[email protected]" };
const frozen: Frozen = { id: 1, name: "Ada" };
frozen.name = "Grace";modifiers.ts(14,8): error TS2540: Cannot assign to 'name' because it is a read-only property.Readonly is shallow and compile-time only. A nested array or object can still be mutated, and nothing stops a JavaScript caller. Use Object.freeze for a runtime guarantee, and DeepReadonly types for nested data.
Partial is the type of an update payload, but it also permits an empty object. If at least one field must be present, you need a stricter type, not Partial.
Choosing properties
| Utility | What it does |
|---|---|
Pick<T, K> | Keeps only the keys in K |
Omit<T, K> | Removes the keys in K |
interface User {
id: number;
name: string;
email: string;
}
type Summary = Pick<User, "id" | "name">;
type Draft = Omit<User, "id">;
const summary: Summary = { id: 1, name: "Ada" };
const draft: Draft = { name: "Ada", email: "[email protected]" };
console.log(summary, draft);{ id: 1, name: 'Ada' } { name: 'Ada', email: '[email protected]' }Pick checks that the keys exist, so a typo is an error. Omit does not: Omit<User, "idd"> compiles and removes nothing, because its key parameter is string | number | symbol. If you want the check, write a stricter helper.
type StrictOmit<T, K extends keyof T> = Omit<T, K>;
interface User {
id: number;
name: string;
}
type Draft = StrictOmit<User, "idd">;strict-omit.ts(7,32): error TS2344: Type '"idd"' does not satisfy the constraint 'keyof User'.Also be aware that Omit on a union type flattens it. Apply it per member with a distributive helper when the type is a union.
Building objects from keys
| Utility | What it does |
|---|---|
Record<K, V> | An object type with keys K and values V |
type Role = "admin" | "member";
const permissions: Record<Role, string[]> = {
admin: ["read", "write"],
member: ["read"],
};
const counts: Record<string, number> = {};
counts["a"] = 1;
console.log(permissions.admin, counts);[ 'read', 'write' ] { a: 1 }With a literal union as the key, Record makes the object exhaustive: a missing role is an error. With plain string, it becomes an index signature, and with noUncheckedIndexedAccess off, reading a missing key gives number rather than number | undefined.
Unions
| Utility | What it does |
|---|---|
Exclude<T, U> | Removes members of T assignable to U |
Extract<T, U> | Keeps members of T assignable to U |
NonNullable<T> | Removes null and undefined |
type Value = string | number | null | undefined;
type OnlyDefined = NonNullable<Value>;
type NoStrings = Exclude<Value, string>;
type OnlyStrings = Extract<Value, string | boolean>;
const a: OnlyDefined = 3;
const b: NoStrings = null;
const c: OnlyStrings = "x";
console.log(a, b, c);3 null xBoth Exclude and Extract distribute over each member of the union, which is why they work as filters. They apply to unions, not to object properties. To filter keys, use Pick and Omit.
Functions
| Utility | What it does |
|---|---|
ReturnType<F> | The return type of a function type |
Parameters<F> | The parameter types as a tuple |
ConstructorParameters<C> | The constructor's parameter tuple |
InstanceType<C> | The type of an instance of class C |
ThisParameterType<F> | The type of this in F |
OmitThisParameter<F> | F without its this parameter |
function createUser(name: string, age: number) {
return { name, age, active: true };
}
type NewUser = ReturnType<typeof createUser>;
type Args = Parameters<typeof createUser>;
const args: Args = ["Ada", 36];
const user: NewUser = createUser(...args);
console.log(user);{ name: 'Ada', age: 36, active: true }Notice typeof createUser. These utilities take a function type, not a function value. With overloads, ReturnType and Parameters read only the last signature, which often surprises people.
Promises
| Utility | What it does |
|---|---|
Awaited<T> | Unwraps a promise type, recursively |
async function load(): Promise<{ id: number }> {
return { id: 1 };
}
type Loaded = Awaited<ReturnType<typeof load>>;
const result: Loaded = { id: 1 };
console.log(result);{ id: 1 }Awaited was added in TypeScript 4.5. It unwraps nested promises and thenables, as await does at runtime, which makes it the right tool for the resolved type of an async function.
Class and this helpers
| Utility | What it does |
|---|---|
NoInfer<T> | Blocks inference of T from that position |
ThisType<T> | Marks the contextual this in object literals |
NoInfer was added in TypeScript 5.4 for generic functions where one argument should decide the type parameter and another should be checked against it.
function pick<T extends string>(options: T[], initial: NoInfer<T>): T {
return options.includes(initial) ? initial : options[0];
}
console.log(pick(["small", "large"], "small"));
console.log(pick(["small", "large"], "medium"));smallThe second call is a compile error, shown here as the compiler would report it before running.
noinfer.ts(6,38): error TS2345: Argument of type '"medium"' is not assignable to parameter of type '"small" | "large"'.Without NoInfer, T would widen to include "medium", and the mistake would go unnoticed. The runtime output shown above applies only to the first call, since the file would not compile with the second.
String helpers
| Utility | Example | Result |
|---|---|---|
Uppercase<S> | Uppercase<"id"> | "ID" |
Lowercase<S> | Lowercase<"ID"> | "id" |
Capitalize<S> | Capitalize<"user"> | "User" |
Uncapitalize<S> | Uncapitalize<"User"> | "user" |
type Field = "name" | "email";
type Getter = `get${Capitalize<Field>}`;
const getter: Getter = "getEmail";
console.log(getter);getEmailThese are intrinsic: the compiler implements them, they cannot be written in the type language. They shine in template literal types, as above.
Combining them
Most real uses stack two or three utilities. An update function takes everything but the identifier, all optional.
interface User {
id: number;
name: string;
email: string;
}
type UserUpdate = Partial<Omit<User, "id">>;
function update(id: number, changes: UserUpdate): User {
return { id, name: "Ada", email: "[email protected]", ...changes };
}
console.log(update(1, { email: "[email protected]" }));{ id: 1, name: 'Ada', email: '[email protected]' }When a combination gets hard to read in an error message, give it a name with a type alias. The alias shows in hovers, and you can document it once.
How utility types work underneath
Every utility type is a short definition in TypeScript's own library file, built from mapped types, conditional types and infer. Reading those definitions removes most of the mystery. Partial<T> is a mapped type that adds ? to each key, and Readonly<T> adds readonly. Pick<T, K> maps over only the keys in K. Record<K, V> maps over the keys in K and gives each the type V. Exclude<T, U> is a conditional type that returns never for each member that matches, and since never disappears from a union, what remains is the filtered result.
This matters for two reasons. First, it explains the behaviors that surprise people: Omit accepts any key because it is defined with Exclude<keyof T, K> over a loose key type, and ReturnType reads the last overload because infer picks the last signature. Second, it means you can write your own helper in the same style when a built-in is almost right. A StrictOmit, a RequireAtLeastOne or a Mutable that removes readonly are each a few lines.
Choosing between similar utilities
Several utilities overlap, and the choice depends on what you start with. To describe an update payload, start from the full type and remove the identifier and make the rest optional. To describe a lookup table keyed by a union, use Record, which enforces that every key is present, rather than an index signature, which allows anything. To describe the result of a function you do not control, use ReturnType and Awaited together, because the first reads the declared return and the second unwraps the promise.
For unions, think in terms of what you have. If you have a union of strings and want fewer of them, use Exclude or Extract. If you have an object type and want fewer keys, use Pick or Omit. Mixing those up is a common source of confusing errors, since both look like "remove something" but operate on different shapes.
Limits to remember
Utility types are compile-time only, so they never change what exists at runtime. Partial<User> does not make a runtime object any more forgiving, and Readonly<User> does not freeze it. They also do not recurse: Partial and Readonly touch the first level only. For deep versions you write a recursive mapped type, which is worth doing for configuration objects but easy to over-engineer. If the types are getting hard to read, a few explicit interfaces are often clearer than a tower of utilities.


