Skip to main content
⚡ OpenDevDocs
TypeScript
programmingtypescriptGuideIntermediate

TypeScript Utility Types (Partial, Pick, Omit, Record)

Mastering built-in TypeScript utility types: Partial, Required, Readonly, Record, Pick, Omit, Exclude, Extract, NonNullable, ReturnType, and Awaited.

Verified: 2026-09-30
Tested on:typescript 5.x
Platforms:
all
#typescript#utility-types#partial#pick#omit#record

TypeScript Utility Types (Partial, Pick, Omit, Record)

TypeScript provides built-in global utility types to facilitate common type transformations.


1. Object Transformation Utilities

Consider a base user model:

interface User {
  id: string;
  name: string;
  email: string;
  age: number;
}
UtilityTransformationExampleResulting Type
Partial<T>Makes all properties optional (?)Partial<User>{ id?: string; name?: string; ... } (for PATCH updates)
Required<T>Makes all properties mandatoryRequired<User>All optional ? modifiers removed
Readonly<T>Makes all properties readonlyReadonly<User>Properties cannot be reassigned
Pick<T, K>Selects a subset of keys from TPick<User, "id" | "email">{ id: string; email: string; }
Omit<T, K>Removes keys K from TOmit<User, "id">{ name: string; email: string; age: number; }
Record<K, V>Creates object type with keys K and values VRecord<string, number>{ [key: string]: number }

2. Union & Function Utilities

UtilityPurposeExample
Exclude<T, U>Excludes types in U from union TExclude<"a" | "b" | "c", "a"> → "b" | "c"
Extract<T, U>Extracts types in U from union TExtract<string | number, string> → string
NonNullable<T>Removes null and undefined from TNonNullable<string | null> → string
ReturnType<T>Obtains the return type of a function type TReturnType<() => number> → number
Parameters<T>Obtains function parameters as a tupleParameters<(a: string, b: number) => void> → [string, number]
Awaited<T>Unwraps Promise types recursivelyAwaited<Promise<string>> → string

On this page