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

Function isTypeDerivedFrom

test/fixtures/snapshot/typescript.js:63853–63860  ·  view source on GitHub ↗
(source, target)

Source from the content-addressed store, hash-verified

63851 // Note that this check ignores type parameters and only considers the
63852 // inheritance hierarchy.
63853 function isTypeDerivedFrom(source, target) {
63854 return source.flags & 1048576 /* TypeFlags.Union */ ? ts.every(source.types, function (t) { return isTypeDerivedFrom(t, target); }) :
63855 target.flags & 1048576 /* TypeFlags.Union */ ? ts.some(target.types, function (t) { return isTypeDerivedFrom(source, t); }) :
63856 source.flags & 58982400 /* TypeFlags.InstantiableNonPrimitive */ ? isTypeDerivedFrom(getBaseConstraintOfType(source) || unknownType, target) :
63857 target === globalObjectType ? !!(source.flags & (524288 /* TypeFlags.Object */ | 67108864 /* TypeFlags.NonPrimitive */)) :
63858 target === globalFunctionType ? !!(source.flags & 524288 /* TypeFlags.Object */) && isFunctionObjectType(source) :
63859 hasBaseType(source, getTargetType(target)) || (isArrayType(target) && !isReadonlyArrayType(target) && isTypeDerivedFrom(source, globalReadonlyArrayType));
63860 }
63861 /**
63862 * This is *not* a bi-directional relationship.
63863 * If one needs to check both directions for comparability, use a second call to this function or 'checkTypeComparableTo'.

Callers 2

removeSubtypesFunction · 0.85
narrowTypeByInstanceofFunction · 0.85

Calls 8

getBaseConstraintOfTypeFunction · 0.85
isFunctionObjectTypeFunction · 0.85
hasBaseTypeFunction · 0.85
getTargetTypeFunction · 0.85
isArrayTypeFunction · 0.85
isReadonlyArrayTypeFunction · 0.85
everyMethod · 0.80
someMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…