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

Function checkIndexConstraints

test/fixtures/snapshot/typescript.js:83807–83836  ·  view source on GitHub ↗
(type, symbol, isStaticIndex)

Source from the content-addressed store, hash-verified

83805 }
83806 }
83807 function checkIndexConstraints(type, symbol, isStaticIndex) {
83808 var indexInfos = getIndexInfosOfType(type);
83809 if (indexInfos.length === 0) {
83810 return;
83811 }
83812 for (var _i = 0, _a = getPropertiesOfObjectType(type); _i < _a.length; _i++) {
83813 var prop = _a[_i];
83814 if (!(isStaticIndex && prop.flags & 4194304 /* SymbolFlags.Prototype */)) {
83815 checkIndexConstraintForProperty(type, prop, getLiteralTypeFromProperty(prop, 8576 /* TypeFlags.StringOrNumberLiteralOrUnique */, /*includeNonPublic*/ true), getNonMissingTypeOfSymbol(prop));
83816 }
83817 }
83818 var typeDeclaration = symbol.valueDeclaration;
83819 if (typeDeclaration && ts.isClassLike(typeDeclaration)) {
83820 for (var _b = 0, _c = typeDeclaration.members; _b < _c.length; _b++) {
83821 var member = _c[_b];
83822 // Only process instance properties with computed names here. Static properties cannot be in conflict with indexers,
83823 // and properties with literal names were already checked.
83824 if (!ts.isStatic(member) && !hasBindableName(member)) {
83825 var symbol_3 = getSymbolOfNode(member);
83826 checkIndexConstraintForProperty(type, symbol_3, getTypeOfExpression(member.name.expression), getNonMissingTypeOfSymbol(symbol_3));
83827 }
83828 }
83829 }
83830 if (indexInfos.length > 1) {
83831 for (var _d = 0, indexInfos_8 = indexInfos; _d < indexInfos_8.length; _d++) {
83832 var info = indexInfos_8[_d];
83833 checkIndexConstraintForIndexSignature(type, info);
83834 }
83835 }
83836 }
83837 function checkIndexConstraintForProperty(type, prop, propNameType, propType) {
83838 var declaration = prop.valueDeclaration;
83839 var name = ts.getNameOfDeclaration(declaration);

Callers 3

Calls 9

getIndexInfosOfTypeFunction · 0.85
hasBindableNameFunction · 0.85
getSymbolOfNodeFunction · 0.85
getTypeOfExpressionFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…