0Pricing
TypeScript Academy · Lesson

Nested Destructuring Patterns

Type deeply nested destructuring expressions.

Reaching Into Nested Data

Nested destructuring extracts values from objects within objects in a single statement. It is concise, but it interacts with types in ways worth understanding — and it can hurt readability if overused.

Destructuring a Nested Property

Mirror the object's shape on the left-hand side. To reach data.user.name, nest a pattern under user.

const data = { user: { name: "Ada", age: 36 } }
const { user: { name } } = data
console.log(name) // Ada

All lessons in this course

  1. Object Destructuring Types
  2. Array and Tuple Destructuring
  3. Default Values in Destructuring
  4. Nested Destructuring Patterns
← Back to TypeScript Academy