(node, signatures, candidatesOutArray, checkMode, callChainFlags, fallbackError)
| 76044 | return ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), typeArguments, ts.Diagnostics.Expected_0_type_arguments_but_got_1, belowArgCount === -Infinity ? aboveArgCount : belowArgCount, argCount); |
| 76045 | } |
| 76046 | function resolveCall(node, signatures, candidatesOutArray, checkMode, callChainFlags, fallbackError) { |
| 76047 | var isTaggedTemplate = node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */; |
| 76048 | var isDecorator = node.kind === 165 /* SyntaxKind.Decorator */; |
| 76049 | var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node); |
| 76050 | var reportErrors = !candidatesOutArray; |
| 76051 | var typeArguments; |
| 76052 | if (!isDecorator) { |
| 76053 | typeArguments = node.typeArguments; |
| 76054 | // We already perform checking on the type arguments on the class declaration itself. |
| 76055 | if (isTaggedTemplate || isJsxOpeningOrSelfClosingElement || node.expression.kind !== 106 /* SyntaxKind.SuperKeyword */) { |
| 76056 | ts.forEach(typeArguments, checkSourceElement); |
| 76057 | } |
| 76058 | } |
| 76059 | var candidates = candidatesOutArray || []; |
| 76060 | // reorderCandidates fills up the candidates array directly |
| 76061 | reorderCandidates(signatures, candidates, callChainFlags); |
| 76062 | if (!candidates.length) { |
| 76063 | if (reportErrors) { |
| 76064 | diagnostics.add(getDiagnosticForCallNode(node, ts.Diagnostics.Call_target_does_not_contain_any_signatures)); |
| 76065 | } |
| 76066 | return resolveErrorCall(node); |
| 76067 | } |
| 76068 | var args = getEffectiveCallArguments(node); |
| 76069 | // The excludeArgument array contains true for each context sensitive argument (an argument |
| 76070 | // is context sensitive it is susceptible to a one-time permanent contextual typing). |
| 76071 | // |
| 76072 | // The idea is that we will perform type argument inference & assignability checking once |
| 76073 | // without using the susceptible parameters that are functions, and once more for those |
| 76074 | // parameters, contextually typing each as we go along. |
| 76075 | // |
| 76076 | // For a tagged template, then the first argument be 'undefined' if necessary because it |
| 76077 | // represents a TemplateStringsArray. |
| 76078 | // |
| 76079 | // For a decorator, no arguments are susceptible to contextual typing due to the fact |
| 76080 | // decorators are applied to a declaration by the emitter, and not to an expression. |
| 76081 | var isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters; |
| 76082 | var argCheckMode = !isDecorator && !isSingleNonGenericCandidate && ts.some(args, isContextSensitive) ? 4 /* CheckMode.SkipContextSensitive */ : 0 /* CheckMode.Normal */; |
| 76083 | argCheckMode |= checkMode & 32 /* CheckMode.IsForStringLiteralArgumentCompletions */; |
| 76084 | // The following variables are captured and modified by calls to chooseOverload. |
| 76085 | // If overload resolution or type argument inference fails, we want to report the |
| 76086 | // best error possible. The best error is one which says that an argument was not |
| 76087 | // assignable to a parameter. This implies that everything else about the overload |
| 76088 | // was fine. So if there is any overload that is only incorrect because of an |
| 76089 | // argument, we will report an error on that one. |
| 76090 | // |
| 76091 | // function foo(s: string): void; |
| 76092 | // function foo(n: number): void; // Report argument error on this overload |
| 76093 | // function foo(): void; |
| 76094 | // foo(true); |
| 76095 | // |
| 76096 | // If none of the overloads even made it that far, there are two possibilities. |
| 76097 | // There was a problem with type arguments for some overload, in which case |
| 76098 | // report an error on that. Or none of the overloads even had correct arity, |
| 76099 | // in which case give an arity error. |
| 76100 | // |
| 76101 | // function foo<T extends string>(x: T): void; // Report type argument error |
| 76102 | // function foo(): void; |
| 76103 | // foo<number>(0); |
no test coverage detected
searching dependent graphs…