Skip to content
Justice Tech School

Intersection Types

A & B combines types: a value must satisfy both. It is the usual way to mix object types together.

Example
type Named = { name: string };
type Aged = { age: number };
type Person = Named & Aged;
const p: Person = { name: "Ada", age: 21 };
console.log(p.name, p.age);

Result

Ada 21

Exercise

Combine two types.

type P = A  B;

Quiz Test

What does A & B require?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.