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

Function narrowTypeByOptionality

test/fixtures/snapshot/typescript.js:71388–71397  ·  view source on GitHub ↗
(type, expr, assumePresent)

Source from the content-addressed store, hash-verified

71386 return type;
71387 }
71388 function narrowTypeByOptionality(type, expr, assumePresent) {
71389 if (isMatchingReference(reference, expr)) {
71390 return getTypeWithFacts(type, assumePresent ? 2097152 /* TypeFacts.NEUndefinedOrNull */ : 262144 /* TypeFacts.EQUndefinedOrNull */);
71391 }
71392 var access = getDiscriminantPropertyAccess(expr, type);
71393 if (access) {
71394 return narrowTypeByDiscriminant(type, access, function (t) { return getTypeWithFacts(t, assumePresent ? 2097152 /* TypeFacts.NEUndefinedOrNull */ : 262144 /* TypeFacts.EQUndefinedOrNull */); });
71395 }
71396 return type;
71397 }
71398 }
71399 function getTypeOfSymbolAtLocation(symbol, location) {
71400 symbol = symbol.exportSymbol || symbol;

Callers 1

narrowTypeFunction · 0.85

Calls 4

isMatchingReferenceFunction · 0.85
getTypeWithFactsFunction · 0.85
narrowTypeByDiscriminantFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…