TheDocumentation Index
Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
Use this file to discover all available pages before exploring further.
& operator in TypeScript creates an intersection type, combining multiple types into a single type that enforces the constraints of all constituent types simultaneously. An entity of an intersection type must satisfy the structural contracts of every type included in the intersection.
Object Type Intersections
When applied to object types, the& operator creates a type that is structurally equivalent to an object containing the union of all property keys from the intersected types. TypeScript does not eagerly flatten or merge these into a new single object type signature; the internal representation remains an intersection, and properties are recursively intersected rather than merged.
Overlapping Properties
If constituent object types share a property key, the TypeScript compiler recursively intersects the types of that specific property. If the shared property contains object types, the intersection is applied to those nested objects:never, as a value cannot simultaneously be multiple distinct primitives.
never, rather than just the individual property.
Primitive Intersections
Applying the& operator directly to mutually exclusive primitive types always yields the bottom type, never.
Top and Bottom Types
The intersection operator has specific, defined interactions with TypeScript’s special top and bottom types:any: Intersecting any typeTwithanyyieldsany(T & any = any).unknown: Intersecting any typeTwithunknownacts as an identity operation, yieldingT(T & unknown = T).never: Intersecting any typeTwith the bottom typeneveryieldsnever(T & never = never).
Function Overloading
When intersecting function signatures, the& operator creates a single function type with multiple call signatures (an overloaded function). The compiler evaluates these signatures in the order they are intersected.
Distributivity over Unions
The intersection operator distributes over the union operator (|). When an intersection is applied to a union type, TypeScript applies the intersection to each member of the union individually.
Master TypeScript with Deep Grasping Methodology!Learn More





