MCPcopy Create free account
hub / github.com/microsoft/typescript-go / getIntersectionType

Method getIntersectionType

internal/checker/checker.go:25946–25948  ·  view source on GitHub ↗

We normalize combinations of intersection and union types based on the distributive property of the '&' operator. Specifically, because X & (A | B) is equivalent to X & A | X & B, we can transform intersection types with union type constituents into equivalent union types with intersection type cons

(types []*Type)

Source from the content-addressed store, hash-verified

25944// Also, unlike union types, the order of the constituent types is preserved in order that overload resolution
25945// for intersections of types with signatures can be deterministic.
25946func (c *Checker) getIntersectionType(types []*Type) *Type {
25947 return c.getIntersectionTypeEx(types, IntersectionFlagsNone, nil /*alias*/)
25948}
25949
25950func (c *Checker) getIntersectionTypeEx(types []*Type, flags IntersectionFlags, alias *TypeAlias) *Type {
25951 var orderedTypes orderedSet[*Type]

Calls 1

getIntersectionTypeExMethod · 0.95

Tested by

no test coverage detected