Intersection Type
In one line
An intersection type (A & B) represents a value that has all properties of both type A and type B. The ampersand & reads as 'and'.
In simple words
An intersection type combines multiple types into one. A value of type A & B must have all properties of A AND all properties of B. You write it with the ampersand: A & B.
Intersections are commonly used for mixins — combining multiple capabilities into a single type. For example, type Timestamped & Identifiable creates a type that has both timestamp properties and ID properties.
When intersecting object types, the result has all properties from all intersected types. When intersecting primitives (like string & number), the result is never because no value can be both a string and a number simultaneously.
Example
type Timestamped = { createdAt: Date };
type Identifiable = { id: string };
type Entity = Timestamped & Identifiable;
const entity: Entity = {
id: "abc-123",
createdAt: new Date(),
};Entity has both id (from Identifiable) and createdAt (from Timestamped).
Common confusions
Confused with: union type
The difference: Intersection (A & B) requires all properties of both. Union (A | B) allows properties of either, but only common properties are accessible without narrowing.
Related terms
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.