Utility types — TypeScript · Foundations

Derive types from types instead of writing them twice: Omit for what a client sends to create, Partial for what it sends to update, Pick for a summary, and a mapped type of your own. The same idea as NestJS's PartialType and OmitType, which apply these to DTO classes.

What you will learn

Read the theory for Utility types

All TypeScript lessons

All Foundations courses

loading types…

What you'll learn

  • Derive types with Omit, Pick, Partial, Required, Readonly and Record, so one change to a model reaches every type built from it
  • Write a mapped type over keyof T
  • Apply a partial update without mutating the original or letting undefined erase a value