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

Function addTypeToUnion

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

Source from the content-addressed store, hash-verified

61123 return false;
61124 }
61125 function addTypeToUnion(typeSet, includes, type) {
61126 var flags = type.flags;
61127 if (flags & 1048576 /* TypeFlags.Union */) {
61128 return addTypesToUnion(typeSet, includes | (isNamedUnionType(type) ? 1048576 /* TypeFlags.Union */ : 0), type.types);
61129 }
61130 // We ignore 'never' types in unions
61131 if (!(flags & 131072 /* TypeFlags.Never */)) {
61132 includes |= flags & 205258751 /* TypeFlags.IncludesMask */;
61133 if (flags & 465829888 /* TypeFlags.Instantiable */)
61134 includes |= 33554432 /* TypeFlags.IncludesInstantiable */;
61135 if (type === wildcardType)
61136 includes |= 8388608 /* TypeFlags.IncludesWildcard */;
61137 if (!strictNullChecks && flags & 98304 /* TypeFlags.Nullable */) {
61138 if (!(ts.getObjectFlags(type) & 65536 /* ObjectFlags.ContainsWideningType */))
61139 includes |= 4194304 /* TypeFlags.IncludesNonWideningType */;
61140 }
61141 else {
61142 var len = typeSet.length;
61143 var index = len && type.id > typeSet[len - 1].id ? ~len : ts.binarySearch(typeSet, type, getTypeId, ts.compareValues);
61144 if (index < 0) {
61145 typeSet.splice(~index, 0, type);
61146 }
61147 }
61148 }
61149 return includes;
61150 }
61151 // Add the given types to the given type set. Order is preserved, duplicates are removed,
61152 // and nested types of the given kind are flattened into the set.
61153 function addTypesToUnion(typeSet, includes, types) {

Callers 1

addTypesToUnionFunction · 0.85

Calls 2

addTypesToUnionFunction · 0.85
isNamedUnionTypeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…