1. Concept library
  2. JavaScript & TypeScript
  3. Module 10: Utility and mapped types

Concept

Partial, Pick and Omit

Built-in utility types derive new types from existing ones: Partial<T> makes every property optional, Pick<T, K> keeps some, Omit<T, K> drops some. They keep update and input types in step with the source.

What a session covers

The tutor works through these with you, in conversation and code. A session ends when you have shown them, not when a video does.

  1. Explain what Partial, Pick and Omit each produce from a type
  2. Derive an input type and an update type from one source type
  3. Spot the Partial<User> patch that lets id and createdAt change

In practice

A few lines that show Partial, Pick and Omit doing its job.

TypeScript
interface User { id: string; name: string; email: string; createdAt: Date }

type NewUser = Omit<User, "id" | "createdAt">;
type UserPatch = Partial<Pick<User, "name" | "email">>;
type UserSummary = Pick<User, "id" | "name">;

function update(id: string, patch: UserPatch) { /* ... */ }
update("7", { name: "Ada" });

The common mistake

Watch for

Using Partial<User> as the type for an update when some fields must never change. It allows id and createdAt in the patch; derive the patch from Pick first.

What to know first

Your roadmap puts these before Partial, Pick and Omit, unless you already know them.

How it stays learned

Once a session shows you understand Partial, Pick and Omit, it comes back for review. Each review takes a minute and tells the memory model how well you still know it.

  1. Day 3First recall, while it is fresh
  2. Day 7Second, a week on
  3. Day 18Last, when it has settled

Where it leads

Topics that build on Partial, Pick and Omit.

Next in the moduleMapped types →