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

Function getApparentType

test/fixtures/snapshot/typescript.js:59131–59144  ·  view source on GitHub ↗

* For a type parameter, return the base constraint of the type parameter. For the string, number, * boolean, and symbol primitive types, return the corresponding object types. Otherwise return the * type itself.

(type)

Source from the content-addressed store, hash-verified

59129 * type itself.
59130 */
59131 function getApparentType(type) {
59132 var t = !(type.flags & 465829888 /* TypeFlags.Instantiable */) ? type : getBaseConstraintOfType(type) || unknownType;
59133 return ts.getObjectFlags(t) & 32 /* ObjectFlags.Mapped */ ? getApparentTypeOfMappedType(t) :
59134 t.flags & 2097152 /* TypeFlags.Intersection */ ? getApparentTypeOfIntersectionType(t) :
59135 t.flags & 402653316 /* TypeFlags.StringLike */ ? globalStringType :
59136 t.flags & 296 /* TypeFlags.NumberLike */ ? globalNumberType :
59137 t.flags & 2112 /* TypeFlags.BigIntLike */ ? getGlobalBigIntType() :
59138 t.flags & 528 /* TypeFlags.BooleanLike */ ? globalBooleanType :
59139 t.flags & 12288 /* TypeFlags.ESSymbolLike */ ? getGlobalESSymbolType() :
59140 t.flags & 67108864 /* TypeFlags.NonPrimitive */ ? emptyObjectType :
59141 t.flags & 4194304 /* TypeFlags.Index */ ? keyofConstraintType :
59142 t.flags & 2 /* TypeFlags.Unknown */ && !strictNullChecks ? emptyObjectType :
59143 t;
59144 }
59145 function getReducedApparentType(type) {
59146 // Since getApparentType may return a non-reduced union or intersection type, we need to perform
59147 // type reduction both before and after obtaining the apparent type. For example, given a type parameter

Callers 15

resolveBaseTypesOfClassFunction · 0.85
getTypeWithThisArgumentFunction · 0.85
getLowerBoundOfKeyTypeFunction · 0.85
resolveMappedTypeMembersFunction · 0.85
getReducedApparentTypeFunction · 0.85
isRelatedToFunction · 0.85
appendPropTypeFunction · 0.85
structuredTypeRelatedToFunction · 0.85
inferFromTypesFunction · 0.85
getEffectsSignatureFunction · 0.85

Calls 5

getBaseConstraintOfTypeFunction · 0.85
getGlobalBigIntTypeFunction · 0.85
getGlobalESSymbolTypeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…