Intersection type

Combines multiple types into one that has all their members.

Since TS 1.6 Spec ↗

Syntax

A & B & C

Examples

type Named = { name: string };
type Aged = { age: number };
type Person = Named & Aged;

const p: Person = { name: 'Ada', age: 36 };
type WithId<T> = T & { id: number };

Notes

An intersection value must satisfy every member type simultaneously. Useful for mixing object shapes and adding fields to a generic. Intersecting conflicting primitive types (for example `string & number`) yields `never`.

See also