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

Function removeRedundantPrimitiveTypes

test/fixtures/snapshot/typescript.js:61471–61484  ·  view source on GitHub ↗
(types, includes)

Source from the content-addressed store, hash-verified

61469 return includes;
61470 }
61471 function removeRedundantPrimitiveTypes(types, includes) {
61472 var i = types.length;
61473 while (i > 0) {
61474 i--;
61475 var t = types[i];
61476 var remove = t.flags & 4 /* TypeFlags.String */ && includes & (128 /* TypeFlags.StringLiteral */ | 134217728 /* TypeFlags.TemplateLiteral */ | 268435456 /* TypeFlags.StringMapping */) ||
61477 t.flags & 8 /* TypeFlags.Number */ && includes & 256 /* TypeFlags.NumberLiteral */ ||
61478 t.flags & 64 /* TypeFlags.BigInt */ && includes & 2048 /* TypeFlags.BigIntLiteral */ ||
61479 t.flags & 4096 /* TypeFlags.ESSymbol */ && includes & 8192 /* TypeFlags.UniqueESSymbol */;
61480 if (remove) {
61481 ts.orderedRemoveItemAt(types, i);
61482 }
61483 }
61484 }
61485 // Check that the given type has a match in every union. A given type is matched by
61486 // an identical type, and a literal type is additionally matched by its corresponding
61487 // primitive type.

Callers 1

getIntersectionTypeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected