(callTarget, argIndex)
| 72582 | return argIndex === -1 ? undefined : getContextualTypeForArgumentAtIndex(callTarget, argIndex); |
| 72583 | } |
| 72584 | function getContextualTypeForArgumentAtIndex(callTarget, argIndex) { |
| 72585 | if (ts.isImportCall(callTarget)) { |
| 72586 | return argIndex === 0 ? stringType : |
| 72587 | argIndex === 1 ? getGlobalImportCallOptionsType(/*reportErrors*/ false) : |
| 72588 | anyType; |
| 72589 | } |
| 72590 | // If we're already in the process of resolving the given signature, don't resolve again as |
| 72591 | // that could cause infinite recursion. Instead, return anySignature. |
| 72592 | var signature = getNodeLinks(callTarget).resolvedSignature === resolvingSignature ? resolvingSignature : getResolvedSignature(callTarget); |
| 72593 | if (ts.isJsxOpeningLikeElement(callTarget) && argIndex === 0) { |
| 72594 | return getEffectiveFirstArgumentForJsxSignature(signature, callTarget); |
| 72595 | } |
| 72596 | var restIndex = signature.parameters.length - 1; |
| 72597 | return signatureHasRestParameter(signature) && argIndex >= restIndex ? |
| 72598 | getIndexedAccessType(getTypeOfSymbol(signature.parameters[restIndex]), getNumberLiteralType(argIndex - restIndex), 256 /* AccessFlags.Contextual */) : |
| 72599 | getTypeAtPosition(signature, argIndex); |
| 72600 | } |
| 72601 | function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { |
| 72602 | if (template.parent.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { |
| 72603 | return getContextualTypeForArgument(template.parent, substitutionExpression); |
no test coverage detected
searching dependent graphs…