(signature, pos)
| 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); |
no test coverage detected
searching dependent graphs…