File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15820,20 +15820,10 @@ namespace ts {
1582015820 }
1582115821 const contextualSignature = getContextualSignature(func);
1582215822 if (contextualSignature) {
15823- const funcHasRestParameter = hasRestParameter(func);
15824- const len = func.parameters.length - (funcHasRestParameter ? 1 : 0);
15825- let indexOfParameter = func.parameters.indexOf(parameter);
15826- if (getThisParameter(func) !== undefined && !contextualSignature.thisParameter) {
15827- Debug.assert(indexOfParameter !== 0); // Otherwise we should not have called `getContextuallyTypedParameterType`.
15828- indexOfParameter -= 1;
15829- }
15830- if (indexOfParameter < len) {
15831- return getTypeAtPosition(contextualSignature, indexOfParameter);
15832- }
15833- // If last parameter is contextually rest parameter get its type
15834- if (funcHasRestParameter && indexOfParameter === len) {
15835- return getRestTypeAtPosition(contextualSignature, indexOfParameter);
15836- }
15823+ const index = func.parameters.indexOf(parameter) - (getThisParameter(func) ? 1 : 0);
15824+ return parameter.dotDotDotToken && lastOrUndefined(func.parameters) === parameter ?
15825+ getRestTypeAtPosition(contextualSignature, index) :
15826+ tryGetTypeAtPosition(contextualSignature, index);
1583715827 }
1583815828 }
1583915829
You can’t perform that action at this time.
0 commit comments