Lesson overview · Free interview practice

Utility Types

Explore built-in utility types and their uses.

Topics in the full lesson
  • Introduction to Utility Types
  • Partial
  • Readonly
  • Pick
  • Omit
  • Record
  • Exclude
  • Extract
  • Other Utility Types
  • Creating Custom Utility Types
  • Best Practices
  • Exercises

Try the free interview questions

Work through a question before revealing its explanation. These questions and answers are free; Premium adds the full lesson walkthrough, examples and implementation detail.

TheoryMedium

`Partial<T>` and `Required<T>`

Question

What do Partial<T> and Required<T> do? Show their implementations and the canonical use cases.

Take a moment to think about this before revealing the answer

Explain your reasoning or try an implementation before comparing answers.

TheoryMedium

Filter and Introspection Utilities

Question

TypeScript has utility types for filtering unions and introspecting functions. Show Exclude/Extract/NonNullable and ReturnType/Parameters.

Take a moment to think about this before revealing the answer

Explain your reasoning or try an implementation before comparing answers.

TheoryMedium

Mapped Types: The Foundation of Utility Types

Question

What is a mapped type, and how do mapping modifiers work? Implement Partial, Required, Readonly, and Mutable from scratch.

Take a moment to think about this before revealing the answer

Explain your reasoning or try an implementation before comparing answers.

TheoryMedium

`Pick<T, K>`, `Omit<T, K>`, and `Record<K, T>`

Question

What do Pick, Omit, and Record do? Show the implementations and the common pitfalls.

Take a moment to think about this before revealing the answer

Explain your reasoning or try an implementation before comparing answers.

TheoryHard

Custom Utility Types: Building Your Own

Question

Implement four canonical custom utility types: DeepPartial<T>, Mutable<T>, RequireOne<T, K>, and PromiseValue<T>. What patterns do they share?

Take a moment to think about this before revealing the answer

Explain your reasoning or try an implementation before comparing answers.

Explore the full Utility Types material

Premium includes the complete lessons and implementation references. Free practice questions remain available without a subscription.

All course tracks & premium content
From basics to advanced masterclasses
Built for JS/TS developers like you
Real-world tips & common pitfalls
Upgrade to Premium