intersection types

Combines multiple types into one. A value of intersection type must satisfy all combined types simultaneously.

Syntax

typescript
type Combined = TypeA & TypeB;

Example

typescript
interface Named { name: string; }
interface Aged { age: number; }

type Person = Named & Aged;

const alice: Person = { name: "Alice", age: 28 };

type AdminUser = User & { permissions: string[] };