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

Function getDiscriminantPropertyAccess

test/fixtures/snapshot/typescript.js:70787–70799  ·  view source on GitHub ↗
(expr, computedType)

Source from the content-addressed store, hash-verified

70785 return undefined;
70786 }
70787 function getDiscriminantPropertyAccess(expr, computedType) {
70788 var type = declaredType.flags & 1048576 /* TypeFlags.Union */ ? declaredType : computedType;
70789 if (type.flags & 1048576 /* TypeFlags.Union */) {
70790 var access = getCandidateDiscriminantPropertyAccess(expr);
70791 if (access) {
70792 var name = getAccessedPropertyName(access);
70793 if (name && isDiscriminantProperty(type, name)) {
70794 return access;
70795 }
70796 }
70797 }
70798 return undefined;
70799 }
70800 function narrowTypeByDiscriminant(type, access, narrowType) {
70801 var propName = getAccessedPropertyName(access);
70802 if (propName === undefined) {

Callers 5

getTypeAtSwitchClauseFunction · 0.85
narrowTypeByTruthinessFunction · 0.85
narrowTypeByOptionalityFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…