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

Function getNullableType

test/fixtures/snapshot/typescript.js:67627–67633  ·  view source on GitHub ↗

* Add undefined or null or both to a type if they are missing. * @param type - type to add undefined and/or null to if not present * @param flags - Either TypeFlags.Undefined or TypeFlags.Null, or both

(type, flags)

Source from the content-addressed store, hash-verified

67625 * @param flags - Either TypeFlags.Undefined or TypeFlags.Null, or both
67626 */
67627 function getNullableType(type, flags) {
67628 var missing = (flags & ~type.flags) & (32768 /* TypeFlags.Undefined */ | 65536 /* TypeFlags.Null */);
67629 return missing === 0 ? type :
67630 missing === 32768 /* TypeFlags.Undefined */ ? getUnionType([type, undefinedType]) :
67631 missing === 65536 /* TypeFlags.Null */ ? getUnionType([type, nullType]) :
67632 getUnionType([type, undefinedType, nullType]);
67633 }
67634 function getOptionalType(type, isProperty) {
67635 if (isProperty === void 0) { isProperty = false; }
67636 ts.Debug.assert(strictNullChecks);

Callers 3

getCommonSupertypeFunction · 0.85

Calls 1

getUnionTypeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…