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

Function getTypeFacts

test/fixtures/snapshot/typescript.js:69590–69667  ·  view source on GitHub ↗
(type, ignoreObjects)

Source from the content-addressed store, hash-verified

69588 resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType));
69589 }
69590 function getTypeFacts(type, ignoreObjects) {
69591 if (ignoreObjects === void 0) { ignoreObjects = false; }
69592 var flags = type.flags;
69593 if (flags & 4 /* TypeFlags.String */) {
69594 return strictNullChecks ? 16317953 /* TypeFacts.StringStrictFacts */ : 16776705 /* TypeFacts.StringFacts */;
69595 }
69596 if (flags & 128 /* TypeFlags.StringLiteral */) {
69597 var isEmpty = type.value === "";
69598 return strictNullChecks ?
69599 isEmpty ? 12123649 /* TypeFacts.EmptyStringStrictFacts */ : 7929345 /* TypeFacts.NonEmptyStringStrictFacts */ :
69600 isEmpty ? 12582401 /* TypeFacts.EmptyStringFacts */ : 16776705 /* TypeFacts.NonEmptyStringFacts */;
69601 }
69602 if (flags & (8 /* TypeFlags.Number */ | 32 /* TypeFlags.Enum */)) {
69603 return strictNullChecks ? 16317698 /* TypeFacts.NumberStrictFacts */ : 16776450 /* TypeFacts.NumberFacts */;
69604 }
69605 if (flags & 256 /* TypeFlags.NumberLiteral */) {
69606 var isZero = type.value === 0;
69607 return strictNullChecks ?
69608 isZero ? 12123394 /* TypeFacts.ZeroNumberStrictFacts */ : 7929090 /* TypeFacts.NonZeroNumberStrictFacts */ :
69609 isZero ? 12582146 /* TypeFacts.ZeroNumberFacts */ : 16776450 /* TypeFacts.NonZeroNumberFacts */;
69610 }
69611 if (flags & 64 /* TypeFlags.BigInt */) {
69612 return strictNullChecks ? 16317188 /* TypeFacts.BigIntStrictFacts */ : 16775940 /* TypeFacts.BigIntFacts */;
69613 }
69614 if (flags & 2048 /* TypeFlags.BigIntLiteral */) {
69615 var isZero = isZeroBigInt(type);
69616 return strictNullChecks ?
69617 isZero ? 12122884 /* TypeFacts.ZeroBigIntStrictFacts */ : 7928580 /* TypeFacts.NonZeroBigIntStrictFacts */ :
69618 isZero ? 12581636 /* TypeFacts.ZeroBigIntFacts */ : 16775940 /* TypeFacts.NonZeroBigIntFacts */;
69619 }
69620 if (flags & 16 /* TypeFlags.Boolean */) {
69621 return strictNullChecks ? 16316168 /* TypeFacts.BooleanStrictFacts */ : 16774920 /* TypeFacts.BooleanFacts */;
69622 }
69623 if (flags & 528 /* TypeFlags.BooleanLike */) {
69624 return strictNullChecks ?
69625 (type === falseType || type === regularFalseType) ? 12121864 /* TypeFacts.FalseStrictFacts */ : 7927560 /* TypeFacts.TrueStrictFacts */ :
69626 (type === falseType || type === regularFalseType) ? 12580616 /* TypeFacts.FalseFacts */ : 16774920 /* TypeFacts.TrueFacts */;
69627 }
69628 if (flags & 524288 /* TypeFlags.Object */) {
69629 if (ignoreObjects) {
69630 return 16768959 /* TypeFacts.AndFactsMask */; // This is the identity element for computing type facts of intersection.
69631 }
69632 return ts.getObjectFlags(type) & 16 /* ObjectFlags.Anonymous */ && isEmptyObjectType(type) ?
69633 strictNullChecks ? 16318463 /* TypeFacts.EmptyObjectStrictFacts */ : 16777215 /* TypeFacts.EmptyObjectFacts */ :
69634 isFunctionObjectType(type) ?
69635 strictNullChecks ? 7880640 /* TypeFacts.FunctionStrictFacts */ : 16728000 /* TypeFacts.FunctionFacts */ :
69636 strictNullChecks ? 7888800 /* TypeFacts.ObjectStrictFacts */ : 16736160 /* TypeFacts.ObjectFacts */;
69637 }
69638 if (flags & (16384 /* TypeFlags.Void */ | 32768 /* TypeFlags.Undefined */)) {
69639 return 9830144 /* TypeFacts.UndefinedFacts */;
69640 }
69641 if (flags & 65536 /* TypeFlags.Null */) {
69642 return 9363232 /* TypeFacts.NullFacts */;
69643 }
69644 if (flags & 12288 /* TypeFlags.ESSymbolLike */) {
69645 return strictNullChecks ? 7925520 /* TypeFacts.SymbolStrictFacts */ : 16772880 /* TypeFacts.SymbolFacts */;
69646 }
69647 if (flags & 67108864 /* TypeFlags.NonPrimitive */) {

Calls 7

isZeroBigIntFunction · 0.85
isEmptyObjectTypeFunction · 0.85
isFunctionObjectTypeFunction · 0.85
isPatternLiteralTypeFunction · 0.85
getBaseConstraintOfTypeFunction · 0.85
maybeTypeOfKindFunction · 0.85
getIntersectionTypeFactsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…