Overview

Utility types transform existing types; this card is the lookup, and composition guidance is in typescript-utility-types. Examples use:

type User = { id: number; name: string; email: string; role: "admin" | "user"; createdAt: Date };

Object shapes

Derive types from User instead of copying fields.

TypeResult
Partial<T> / Required<T>Every field optional / every field required.
Readonly<T>Every field readonly.
Pick<T, K>Only keys K: Pick<User, "id" | "name">.
Omit<T, K>Everything except K: Omit<User, "createdAt">.
Record<K, V>Object with keys K and values V: Record<string, User>.
type UpdateUser = Partial<Omit<User, "id" | "createdAt">>;   // PATCH payload
type UserSummary = Pick<User, "id" | "name" | "role">;       // API response

Unions

Use Exclude and Extract to filter unions, not objects.

TypeResult
Exclude<T, U>Members of T not assignable to U: Exclude<"a" | "b", "a"> is "b".
Extract<T, U>Members of T assignable to U.
NonNullable<T>T without null and undefined.

Functions and promises

Derive types from functions with ReturnType and Awaited.

TypeResult
ReturnType<typeof f>Return type of f.
Parameters<typeof f>Parameter tuple: [id: number, opts?: {...}].
ConstructorParameters<typeof C>, InstanceType<typeof C>Constructor arguments / constructed type.
Awaited<T>Recursively unwraps promises: Awaited<ReturnType<typeof load>>.
NoInfer<T>Blocks inference from this position (TypeScript 5.4+).
ThisParameterType<F>, OmitThisParameter<F>Read / remove a function’s this type.

String types

Use string types with template literals for key and event names.

TypeResult
Uppercase<S>, Lowercase<S>Case conversion of a literal type.
Capitalize<S>, Uncapitalize<S>First letter only.
type HandlerName = `on${Capitalize<"click" | "focus">}`;   // "onClick" | "onFocus"

Gotchas

Avoid these; each type check passes without protecting you.

GotchaFix
Omit<T, K> accepts any key, so a typo like "createdAT" silently omits nothing.Use Pick for a checked key list, or a strict omit helper.
Partial<T> is shallow.Write a recursive DeepPartial<T>.
Record<string, User> types a missing key as User, not User | undefined.Enable noUncheckedIndexedAccess.
ReturnType of an overloaded function uses the last overload.Annotate the type you want explicitly.
Exclude filters union members; it cannot remove object properties.Use Omit for properties.