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

Function getGlobalNonNullableTypeInstantiation

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

Source from the content-addressed store, hash-verified

67637 return type.flags & 32768 /* TypeFlags.Undefined */ ? type : getUnionType([type, isProperty ? missingType : undefinedType]);
67638 }
67639 function getGlobalNonNullableTypeInstantiation(type) {
67640 // First reduce away any constituents that are assignable to 'undefined' or 'null'. This not only eliminates
67641 // 'undefined' and 'null', but also higher-order types such as a type parameter 'U extends undefined | null'
67642 // that isn't eliminated by a NonNullable<T> instantiation.
67643 var reducedType = getTypeWithFacts(type, 2097152 /* TypeFacts.NEUndefinedOrNull */);
67644 if (!deferredGlobalNonNullableTypeAlias) {
67645 deferredGlobalNonNullableTypeAlias = getGlobalSymbol("NonNullable", 524288 /* SymbolFlags.TypeAlias */, /*diagnostic*/ undefined) || unknownSymbol;
67646 }
67647 // If the NonNullable<T> type is available, return an instantiation. Otherwise just return the reduced type.
67648 return deferredGlobalNonNullableTypeAlias !== unknownSymbol ?
67649 getTypeAliasInstantiation(deferredGlobalNonNullableTypeAlias, [reducedType]) :
67650 reducedType;
67651 }
67652 function getNonNullableType(type) {
67653 return strictNullChecks ? getGlobalNonNullableTypeInstantiation(type) : type;
67654 }

Callers 1

getNonNullableTypeFunction · 0.85

Calls 3

getTypeWithFactsFunction · 0.85
getGlobalSymbolFunction · 0.85

Tested by

no test coverage detected