TypeScript Utility Types: Pick, Omit, Partial, and Record Explained
How Pick, Omit, Partial, and Record are built from mapped types: what each preserves, why Omit accepts a typo, how Partial distributes over unions, and the errors each raises.

Pick, Omit, Partial, and Record are not built-in magic; each is a mapped type a few characters long, and almost every surprise they produce is decided by two details of that definition — whether the mapped type is homomorphic over keyof T, and how the key parameter is constrained. Partial<T> is { [P in keyof T]?: T[P] }, so it distributes over unions and maps tuples in place. Omit<T, K> is Pick<T, Exclude<keyof T, K>>, so it does neither and quietly accepts keys that do not exist.
Quick Summary
Partial<T>makes every property optional. It is homomorphic, so it keepsreadonly, keeps optionality of properties that already had it, and distributes over unions.Pick<T, K>keeps onlyK, andKmust extendkeyof T, so an unknown key is a compile error.Omit<T, K>removesKand constrainsKtokeyof any, so a misspelled key compiles and does nothing.Record<K, T>builds an object type with exactly the keys inKand value typeT. It requires every key, andKmay bestringto produce an index signature.Partialis shallow. Nested objects stay fully required unless a recursive type is written by hand.Omitis not homomorphic, so it does not preserve tuple and array structure, and it does not distribute over unions.
Basic syntax and type signatures
The definitions are short enough to read from lib.es5.d.ts, and reading them answers most questions:
type Partial<T> = { [P in keyof T]?: T[P] };
type Required<T> = { [P in keyof T]-?: T[P] };
type Pick<T, K extends keyof T> = { [P in K]: T[P] };
type Record<K extends keyof any, T> = { [P in K]: T };
type Omit<T, K extends keyof any> = Pick<T, Exclude<keyof T, K>>;keyof any resolves to string | number | symbol, which is why Record<"a" | "b", V> and Record<string, V> share one definition while Pick<T, "typo"> fails immediately: "typo" is not assignable to keyof T. Omit has no such guard, because its K is only checked against the set of all possible keys, not against the keys of T.
Every one of these is erased at compile time. Pick<User, "id"> and { id: number } are the same type, so the choice between them is about maintenance, not runtime cost.
interface User {
id: number;
name: string;
email?: string;
readonly createdAt: number;
}
type Preview = Pick<User, "id" | "email" | "createdAt">;
// { id: number; email?: string; readonly createdAt: number }Pick copies the ? and readonly modifiers from the source, so Preview keeps email optional instead of promoting it to a required string | undefined.
The four utilities side by side
| Utility | Definition shape | Key constraint | Over a union A | B | Arrays and tuples |
|---|---|---|---|---|
Partial<T> | [P in keyof T]? | none | distributes to Partial<A> | Partial<B> | element type becomes optional |
Pick<T, K> | [P in K] | K extends keyof T | keys collapse to keyof A & keyof B | tuple structure lost |
Omit<T, K> | Pick<T, Exclude<keyof T, K>> | K extends keyof any | one object of the shared keys | tuple structure lost |
Record<K, T> | [P in K] | K extends keyof any | not distributive, K is the key set | not applicable |
The union column is where most production bugs start. keyof (A | B) is the intersection of the two key sets, so Pick<Shape, "kind"> and Omit<Shape, "kind"> both flatten a discriminated union into one object built from the keys every member shares.
Practical edge cases and deep dives
1. Partial is shallow, so nested settings stay required
A settings type with one nested block is the usual place where Partial<Settings> fails to type-check the object people actually pass:
interface Settings {
theme: "light" | "dark";
notifications: { email: boolean; push: boolean };
}
const patch: Partial<Settings> = {
theme: "dark",
notifications: { email: false },
// error TS2741: Property 'push' is missing in type
// '{ email: boolean; }' but required in type '{ email: boolean; push: boolean; }'
};The fix is a recursive mapped type, which must handle arrays explicitly or it will turn every array into an object of numeric keys:
type DeepPartial<T> = T extends (infer U)[]
? DeepPartial<U>[]
: T extends object
? { [P in keyof T]?: DeepPartial<T[P]> }
: T;DeepPartial also drops the homomorphic link to the original type, so readonly survives only where the object type carries it, and explicitly undefined-able properties behave differently under exactOptionalPropertyTypes.
2. Omit accepts a typo, so pin the key
Omit<User, "emial"> compiles and returns all of User. Nothing warns, because "emial" is a valid keyof any. A one-line helper restores the check by inheriting Pick's constraint:
type StrictOmit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
type WithoutEmail = StrictOmit<User, "emial">;
// error TS2344: Type '"emial"' does not satisfy the constraint 'keyof User'The same looseness appears in reverse: Omit<T, keyof T> yields {}, which accepts any object because excess property checks do not apply to an empty target — a valid type and a useless one.
3. Keeping a discriminant while partializing a union
Partial<Shape> distributes across the union, which makes kind optional and breaks narrowing: a value can now have kind: undefined and no usable member.
type Shape =
| { kind: "circle"; radius: number }
| { kind: "square"; side: number };
type Draft = Partial<Shape>; // kind is optional on both members
type Patch = Partial<Omit<Shape, "kind">> & Pick<Shape, "kind">;
// keyof (A | B) is just "kind", so Omit<Shape, "kind"> is {}
declare const patch: Patch;
if (patch.kind === "circle") {
patch.radius; // error TS2339: 'radius' does not exist on type 'Patch'
}Omit here flattens the union before Partial sees it, so Patch only carries the shared keys — kind plus nothing else. To keep per-member optionality, distribute first with a conditional type over the naked type parameter:
type PartialKeys<T, K extends PropertyKey> =
Omit<T, Extract<keyof T, K>> & Partial<Pick<T, Extract<keyof T, K>>>;
type DistributedPatch = Shape extends unknown ? PartialKeys<Shape, "radius" | "side"> : never;
// { kind: "circle"; radius?: number } | { kind: "square"; side?: number }Extract<keyof T, K> is what lets one key list serve both members: it resolves to "radius" for the circle and to "side" for the square, so the keyof T constraint on Pick and Omit is satisfied in each branch.
4. Record for exhaustive maps, Partial<Record> for sparse ones
Record<Status, string> demands every status and returns string with no undefined in the type. A Partial<Record<Status, string>> is the sparse version, and the difference is visible at every read:
type Status = "idle" | "loading" | "error";
const labels: Record<Status, string> = { idle: "Idle", loading: "Loading", error: "Failed" };
const labelsRead: string = labels.idle;
const cache: Partial<Record<Status, string>> = {};
const cached: string | undefined = cache.idle;
const index: Record<string, string> = {};
const anyKey: string | undefined = index["missing"]; // only with noUncheckedIndexedAccessThe last line is the trap: Record<string, string> describes keys that are assumed present, so without noUncheckedIndexedAccess a lookup returns string and blows up at runtime instead of returning undefined.
Common mistakes and compiler errors
| Symptom | Cause | Fix |
|---|---|---|
Type 'string' does not satisfy the constraint 'keyof T' (TS2344) | Pick<T, keyof typeof obj> where obj is a plain string[] or the key was widened | pass a literal union or as const |
Property is missing in type … but required in type Pick<…> | Pick keeps required properties required | wrap in Partial, or pick fewer keys |
A misspelled Omit key compiles and changes nothing | K extends keyof any | use StrictOmit, or satisfies the key list |
Nested object still required after Partial | Partial is shallow | write DeepPartial, or partialize the nested type |
shape.kind is undefined after partializing a union | Partial distributed over the union | keep the discriminant with Pick |
Omit<Union, K> lost every member but the shared keys | keyof of a union is an intersection | distribute first with a conditional type |
Index access returns string but is undefined at runtime | Record<string, V> assumes the key exists | enable noUncheckedIndexedAccess or use Partial<Record<…>> |
Array type lost map after Omit | Omit is not homomorphic | use Partial or a mapped type over the array |
The rule behind the table is the definition itself: reach for Pick and Partial when the property list must stay honest, and for Omit only when the excluded keys are already typed somewhere, because it is the one utility of the four that cannot tell a typo from a real key.
Try matching browser tools
All toolsSmall utilities that fit TypeScript work — they run entirely in this browser tab, so nothing you paste leaves your device.
Related TypeScript guides
All TypeScript guidesTypeScript Generic Parameter Defaults: Syntax, Precedence, and Inference
When a default applies and when inference wins, defaults that reference earlier parameters, and how a defaulted type parameter keeps a library change non-breaking.
TypeScript Branded Types: Nominal Typing, Type Tags, and Validation
How a phantom property makes two strings incompatible, unique symbol brands, unit-typed numbers, and the places where a brand quietly disappears.
TypeScript Ambient Declarations: .d.ts Files, declare, and declare global
How declare and .d.ts files describe runtime values, wildcard modules for assets, declare global with var, and module augmentation of third-party types.
TypeScript Discriminated Unions: Exhaustiveness Checking and the never Type
Why the discriminant must be a literal, how never closes an exhaustive switch, and the duplicate-discriminant bug that lets a missing case compile.
More in TypeScript
All TypeScript guidesThe guides filed next to this one in TypeScript, in library order.