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

Function getIndexType

test/fixtures/snapshot/typescript.js:61862–61875  ·  view source on GitHub ↗
(type, stringsOnly, noIndexSignatures)

Source from the content-addressed store, hash-verified

61860 });
61861 }
61862 function getIndexType(type, stringsOnly, noIndexSignatures) {
61863 if (stringsOnly === void 0) { stringsOnly = keyofStringsOnly; }
61864 type = getReducedType(type);
61865 return type.flags & 1048576 /* TypeFlags.Union */ ? isPossiblyReducibleByInstantiation(type)
61866 ? getIndexTypeForGenericType(type, stringsOnly)
61867 : getIntersectionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) :
61868 type.flags & 2097152 /* TypeFlags.Intersection */ ? getUnionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) :
61869 type.flags & 58982400 /* TypeFlags.InstantiableNonPrimitive */ || isGenericTupleType(type) || isGenericMappedType(type) && !hasDistributiveNameType(type) ? getIndexTypeForGenericType(type, stringsOnly) :
61870 ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */ ? getIndexTypeForMappedType(type, stringsOnly, noIndexSignatures) :
61871 type === wildcardType ? wildcardType :
61872 type.flags & 2 /* TypeFlags.Unknown */ ? neverType :
61873 type.flags & (1 /* TypeFlags.Any */ | 131072 /* TypeFlags.Never */) ? keyofConstraintType :
61874 getLiteralTypeFromProperties(type, (noIndexSignatures ? 128 /* TypeFlags.StringLiteral */ : 402653316 /* TypeFlags.StringLike */) | (stringsOnly ? 0 : 296 /* TypeFlags.NumberLike */ | 12288 /* TypeFlags.ESSymbolLike */), stringsOnly === keyofStringsOnly && !noIndexSignatures);
61875 }
61876 function getExtractStringType(type) {
61877 if (keyofStringsOnly) {
61878 return type;

Callers 12

createTypeCheckerFunction · 0.85
getLowerBoundOfKeyTypeFunction · 0.85
getKnownKeysOfTupleTypeFunction · 0.85
getIndexTypeOrStringFunction · 0.85
instantiateTypeWorkerFunction · 0.85
structuredTypeRelatedToFunction · 0.85
inferToMappedTypeFunction · 0.85
findMostOverlappyTypeFunction · 0.85

Calls 11

getReducedTypeFunction · 0.85
getIntersectionTypeFunction · 0.85
getUnionTypeFunction · 0.85
isGenericTupleTypeFunction · 0.85
isGenericMappedTypeFunction · 0.85
hasDistributiveNameTypeFunction · 0.85
mapMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…