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

Function tryGetTypeAtPosition

test/fixtures/snapshot/typescript.js:77547–77563  ·  view source on GitHub ↗
(signature, pos)

Source from the content-addressed store, hash-verified

77545 return tryGetTypeAtPosition(signature, pos) || anyType;
77546 }
77547 function tryGetTypeAtPosition(signature, pos) {
77548 var paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0);
77549 if (pos < paramCount) {
77550 return getTypeOfParameter(signature.parameters[pos]);
77551 }
77552 if (signatureHasRestParameter(signature)) {
77553 // We want to return the value undefined for an out of bounds parameter position,
77554 // so we need to check bounds here before calling getIndexedAccessType (which
77555 // otherwise would return the type 'undefined').
77556 var restType = getTypeOfSymbol(signature.parameters[paramCount]);
77557 var index = pos - paramCount;
77558 if (!isTupleType(restType) || restType.target.hasRestElement || index < restType.target.fixedLength) {
77559 return getIndexedAccessType(restType, getNumberLiteralType(index));
77560 }
77561 }
77562 return undefined;
77563 }
77564 function getRestTypeAtPosition(source, pos) {
77565 var parameterCount = getParameterCount(source);
77566 var minArgumentCount = getMinArgumentCount(source);

Callers 7

combineUnionParametersFunction · 0.85
compareSignaturesRelatedFunction · 0.85
_loop_26Function · 0.85
getTypeAtPositionFunction · 0.85

Calls 6

getTypeOfParameterFunction · 0.85
getTypeOfSymbolFunction · 0.85
isTupleTypeFunction · 0.85
getIndexedAccessTypeFunction · 0.85
getNumberLiteralTypeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…