File tree Expand file tree Collapse file tree 1 file changed +4
-14
lines changed Expand file tree Collapse file tree 1 file changed +4
-14
lines changed Original file line number Diff line number Diff line change @@ -15820,20 +15820,10 @@ namespace ts {
15820
15820
}
15821
15821
const contextualSignature = getContextualSignature(func);
15822
15822
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);
15837
15827
}
15838
15828
}
15839
15829
You can’t perform that action at this time.
0 commit comments