Script Valley
TypeScript: Complete Course from Zero
GenericsLesson 4.4

Built-in TypeScript utility types Partial, Required, Readonly, Pick, Omit

Partial type, Required type, Readonly type, Pick type, Omit type, practical use cases for each, combining utility types

Utility types overview

TypeScript ships built-in utility types that transform existing types without rewriting them:

interface User {
  id: number;
  name: string;
  email: string;
  password: string;
}

type PartialUser  = Partial;          // all fields optional
type RequiredUser = Required>; // all fields required
type ReadonlyUser = Readonly;          // all fields readonly
type PublicUser   = Omit; // remove password
type Credentials  = Pick; // keep only these

Real-world patterns

// Update endpoint: only send changed fields
function updateUser(id: number, changes: Partial>) {
  // changes has optional name, email, password โ€” no id
}

// Create endpoint: no id (auto-generated)
type CreateUserDTO = Omit;
function createUser(dto: CreateUserDTO): User {
  return { id: Date.now(), ...dto };
}

Composing utility types is idiomatic TypeScript. You rarely need to manually rewrite types when these tools cover the common transformations.

Up next

Generic utility types ReturnType, Parameters, and Awaited explained

Sign in to track progress

Built-in TypeScript utility types Partial, Required, Readonly, Pick, Omit โ€” Generics โ€” TypeScript: Complete Course from Zero โ€” Script Valley โ€” Script Valley