Skip to content

Commit 52293ed

Browse files
committed
Fix inference when source and target both have rest parameters
1 parent 0226b66 commit 52293ed

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13128,10 +13128,8 @@ namespace ts {
1312813128
const targetCount = getParameterCount(target);
1312913129
const sourceRestType = getEffectiveRestType(source);
1313013130
const targetRestType = getEffectiveRestType(target);
13131-
const paramCount = targetRestType ? Math.min(targetCount - 1, sourceCount) :
13132-
sourceRestType ? targetCount :
13133-
Math.min(sourceCount, targetCount);
13134-
13131+
const targetNonRestCount = targetRestType ? targetCount - 1 : targetCount;
13132+
const paramCount = sourceRestType ? targetNonRestCount : Math.min(sourceCount, targetNonRestCount);
1313513133
const sourceThisType = getThisTypeOfSignature(source);
1313613134
if (sourceThisType) {
1313713135
const targetThisType = getThisTypeOfSignature(target);

0 commit comments

Comments
 (0)