Lesson 17 — Utility types
Build new types from old ones
TypeScript ships utility types that transform a type you already have. Partial<T> makes every property optional — perfect for "change only some fields" updates. Pick<T, "a" | "b"> keeps only the listed properties. Others include Omit, Readonly and Record.
interface Post { title: string; body: string; likes: number }
type PostPreview = Pick<Post, "title">; // { title: string }
type PostEdit = Partial<Post>; // every field optional
Why it matters: you derive types instead of copying them, so they never drift apart.
Make patch set only done: true, and copy the title into preview. Expect done true and { title: 'Write' }.
Run your code — when the output matches the task, you will see a green check. Then mark the lesson complete.
A quick 3-question quiz on this lesson — instant feedback.
Ready for more? Optional paid resources that pick up where this lesson leaves off.
Some links on this page are affiliate links: we may earn a commission at no extra cost to you. As an Amazon Associate I earn from qualifying purchases.
Project-based TypeScript Foundations courses if you want a structured paid path after the free lessons. Wait for a sale — prices drop often.
Browse on Udemy →Search Amazon for TypeScript Foundations books — check the publication year so the examples match current versions.
Search Amazon →