Skip to content
Guest
Learn TypeScript · Course Syllabus Show lessons
Advanced TypeScript · 8 min read · Intermediate

Built-in Utility Types

Derive new types cleanly without duplication using Partial, Required, Pick, Omit, and Record.

What you'll learn

  • Accept patch updates cleanly with Partial<T>
  • Shape API payloads with Pick<T, K> and Omit<T, K>
  • Type key-value dictionaries cleanly with Record<K, V>

TypeScript ships with built-in utility types so you never have to copy-paste interfaces:

  • Partial<User>: makes every field optional (perfect for updateUser(id, patch)).
  • Pick<User, "id" | "name">: keeps only selected properties.
  • Omit<User, "passwordHash">: strips sensitive fields before returning an API response.
  • Record<string, number>: maps string keys to number values.

Fill-in-the-Blank Exercise

Strip Sensitive Fields with Omit

Create PublicUser by omitting passwordHash from User.

type PublicUser = <User, "passwordHash">;
type ScoreMap = <string, number>;

Live Code Lab

TypeScriptutilities.ts
Expected OutputClick “Run Live” to compile with TypeScript 5.6
Maya: 96

Check Your Understanding

Score: 0 / 1

1. Which TypeScript utility type makes all properties of an interface optional for PATCH updates?

Study Workspace

Finished this lesson?

Your progress is saved locally in your browser, no account needed.

Search courses, lessons, and references

Type to search across all courses, lessons, and quick references.

Press Esc to close Powered by Pagefind