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

Function getDefinitelyFalsyPartOfType

test/fixtures/snapshot/typescript.js:67610–67621  ·  view source on GitHub ↗
(type)

Source from the content-addressed store, hash-verified

67608 return mapType(type, getDefinitelyFalsyPartOfType);
67609 }
67610 function getDefinitelyFalsyPartOfType(type) {
67611 return type.flags & 4 /* TypeFlags.String */ ? emptyStringType :
67612 type.flags & 8 /* TypeFlags.Number */ ? zeroType :
67613 type.flags & 64 /* TypeFlags.BigInt */ ? zeroBigIntType :
67614 type === regularFalseType ||
67615 type === falseType ||
67616 type.flags & (16384 /* TypeFlags.Void */ | 32768 /* TypeFlags.Undefined */ | 65536 /* TypeFlags.Null */ | 3 /* TypeFlags.AnyOrUnknown */) ||
67617 type.flags & 128 /* TypeFlags.StringLiteral */ && type.value === "" ||
67618 type.flags & 256 /* TypeFlags.NumberLiteral */ && type.value === 0 ||
67619 type.flags & 2048 /* TypeFlags.BigIntLiteral */ && isZeroBigInt(type) ? type :
67620 neverType;
67621 }
67622 /**
67623 * Add undefined or null or both to a type if they are missing.
67624 * @param type - type to add undefined and/or null to if not present

Callers

nothing calls this directly

Calls 1

isZeroBigIntFunction · 0.85

Tested by

no test coverage detected