0Pricing
TypeScript Academy · Lesson

Partial and Required: Toggling Optionality

Make all properties optional or required at once.

Welcome

Partial makes all properties optional. Required makes all properties required. They are the most commonly used utility types for flexible data manipulation.

Partial<T>

Partial makes every property of T optional. Useful for update/patch operations where you don't have all fields.
interface User { id: number; name: string; email: string; }
type PartialUser = Partial<User>;
// { id?: number; name?: string; email?: string; }

All lessons in this course

  1. Partial and Required: Toggling Optionality
  2. Pick and Omit: Selecting Properties
  3. Record: Mapping Keys to Value Types
  4. Readonly, Exclude, Extract, NonNullable
← Back to TypeScript Academy