Intersection Type
Question
What does an intersection type A & B mean?
Hint
Intersections combine multiple types into one.
Explanation
An intersection type A & B means a value must have all properties of both A and B. Example: type Employee = Person & { salary: number }. The resulting type has all properties from Person plus salary. Intersections are useful for mixins, combining multiple interfaces, and adding properties to existing types. If A and B have conflicting property types, the property becomes never.
Related Resources
Related Lessons
- Unions & Intersections
Learn unions/intersections.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.