0Pricing
TypeScript Academy · Lesson

Intersection Types: A and B

Combine types with & to merge their properties.

Welcome

Intersection types combine multiple types into one. A value of an intersection type must satisfy ALL of the combined types simultaneously.

Basic Intersection Syntax

Use the `&` operator to create an intersection. The result has all properties of both types.
type Named = { name: string };
type Aged = { age: number };
type Person = Named & Aged;
const alice: Person = { name: 'Alice', age: 30 };

All lessons in this course

  1. Union Types: A or B
  2. Intersection Types: A and B
  3. Discriminated Unions for Safe Pattern Matching
  4. Practical Patterns with Union and Intersection
← Back to TypeScript Academy