Skip to content

Commit da3fdd1

Browse files
committed
Fix arity error sometimes reaching out of bounds of the arguments actually present
1 parent 8576018 commit da3fdd1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20600,7 +20600,7 @@ namespace ts {
2060020600
spanArray = createNodeArray(args);
2060120601
if (hasSpreadArgument && argCount) {
2060220602
const nextArg = elementAt(args, getSpreadArgumentIndex(args) + 1) || undefined;
20603-
spanArray = createNodeArray(args.slice(max > argCount && nextArg ? args.indexOf(nextArg) : max));
20603+
spanArray = createNodeArray(args.slice(max > argCount && nextArg ? args.indexOf(nextArg) : Math.min(max, args.length - 1)));
2060420604
}
2060520605
}
2060620606
else {

0 commit comments

Comments
 (0)