MCPcopy Index your code
hub / github.com/nodejs/node / addTypeToIntersection

Function addTypeToIntersection

test/fixtures/snapshot/typescript.js:61428–61461  ·  view source on GitHub ↗
(typeSet, includes, type)

Source from the content-addressed store, hash-verified

61426 return links.resolvedType;
61427 }
61428 function addTypeToIntersection(typeSet, includes, type) {
61429 var flags = type.flags;
61430 if (flags & 2097152 /* TypeFlags.Intersection */) {
61431 return addTypesToIntersection(typeSet, includes, type.types);
61432 }
61433 if (isEmptyAnonymousObjectType(type)) {
61434 if (!(includes & 16777216 /* TypeFlags.IncludesEmptyObject */)) {
61435 includes |= 16777216 /* TypeFlags.IncludesEmptyObject */;
61436 typeSet.set(type.id.toString(), type);
61437 }
61438 }
61439 else {
61440 if (flags & 3 /* TypeFlags.AnyOrUnknown */) {
61441 if (type === wildcardType)
61442 includes |= 8388608 /* TypeFlags.IncludesWildcard */;
61443 }
61444 else if (strictNullChecks || !(flags & 98304 /* TypeFlags.Nullable */)) {
61445 if (exactOptionalPropertyTypes && type === missingType) {
61446 includes |= 262144 /* TypeFlags.IncludesMissingType */;
61447 type = undefinedType;
61448 }
61449 if (!typeSet.has(type.id.toString())) {
61450 if (type.flags & 109440 /* TypeFlags.Unit */ && includes & 109440 /* TypeFlags.Unit */) {
61451 // We have seen two distinct unit types which means we should reduce to an
61452 // empty intersection. Adding TypeFlags.NonPrimitive causes that to happen.
61453 includes |= 67108864 /* TypeFlags.NonPrimitive */;
61454 }
61455 typeSet.set(type.id.toString(), type);
61456 }
61457 }
61458 includes |= flags & 205258751 /* TypeFlags.IncludesMask */;
61459 }
61460 return includes;
61461 }
61462 // Add the given types to the given type set. Order is preserved, freshness is removed from literal
61463 // types, duplicates are removed, and nested types of the given kind are flattened into the set.
61464 function addTypesToIntersection(typeSet, includes, types) {

Callers 1

addTypesToIntersectionFunction · 0.85

Calls 5

addTypesToIntersectionFunction · 0.85
hasMethod · 0.65
setMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected