From 52293edce517035d584559df8fcfd83cd036720c Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Wed, 12 Sep 2018 12:33:37 -0700 Subject: [PATCH] Fix inference when source and target both have rest parameters --- src/compiler/checker.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 5aaa236f0e0..c8e9ed58797 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -13128,10 +13128,8 @@ namespace ts { const targetCount = getParameterCount(target); const sourceRestType = getEffectiveRestType(source); const targetRestType = getEffectiveRestType(target); - const paramCount = targetRestType ? Math.min(targetCount - 1, sourceCount) : - sourceRestType ? targetCount : - Math.min(sourceCount, targetCount); - + const targetNonRestCount = targetRestType ? targetCount - 1 : targetCount; + const paramCount = sourceRestType ? targetNonRestCount : Math.min(sourceCount, targetNonRestCount); const sourceThisType = getThisTypeOfSignature(source); if (sourceThisType) { const targetThisType = getThisTypeOfSignature(target);