MCPcopy Create free account
hub / github.com/nodejs/node / getIndexInfosOfIndexSymbol

Function getIndexInfosOfIndexSymbol

test/fixtures/snapshot/typescript.js:60036–60058  ·  view source on GitHub ↗
(indexSymbol)

Source from the content-addressed store, hash-verified

60034 return indexSymbol ? getIndexInfosOfIndexSymbol(indexSymbol) : ts.emptyArray;
60035 }
60036 function getIndexInfosOfIndexSymbol(indexSymbol) {
60037 if (indexSymbol.declarations) {
60038 var indexInfos_4 = [];
60039 var _loop_14 = function (declaration) {
60040 if (declaration.parameters.length === 1) {
60041 var parameter = declaration.parameters[0];
60042 if (parameter.type) {
60043 forEachType(getTypeFromTypeNode(parameter.type), function (keyType) {
60044 if (isValidIndexKeyType(keyType) && !findIndexInfo(indexInfos_4, keyType)) {
60045 indexInfos_4.push(createIndexInfo(keyType, declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, ts.hasEffectiveModifier(declaration, 64 /* ModifierFlags.Readonly */), declaration));
60046 }
60047 });
60048 }
60049 }
60050 };
60051 for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
60052 var declaration = _a[_i];
60053 _loop_14(declaration);
60054 }
60055 return indexInfos_4;
60056 }
60057 return ts.emptyArray;
60058 }
60059 function isValidIndexKeyType(type) {
60060 return !!(type.flags & (4 /* TypeFlags.String */ | 8 /* TypeFlags.Number */ | 4096 /* TypeFlags.ESSymbol */)) || isPatternLiteralType(type) ||
60061 !!(type.flags & 2097152 /* TypeFlags.Intersection */) && !isGenericType(type) && ts.some(type.types, isValidIndexKeyType);

Callers 2

getIndexInfosOfSymbolFunction · 0.85

Calls 1

_loop_14Function · 0.85

Tested by

no test coverage detected