Skip to content

Commit 351f665

Browse files
committed
Bail when argument and parameter lists are misaligned
The mechanism used to match up arguments and parameters here is very brittle, and can easily be broken by e.g. rest parameters. For purposes of the POC we deal with this by simply discarding such a usage site.
1 parent 7672747 commit 351f665

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
@@ -16757,7 +16757,7 @@ namespace ts {
1675716757
return
1675816758
const sig = getSignatureFromDeclaration(funcSymbol.valueDeclaration)
1675916759
const parameterTypes = sig.parameters.map(getTypeOfParameter)
16760-
const argumentTypes = usages.map(({ i }) => parameterTypes[i])
16760+
const argumentTypes = usages.map(({ i }) => parameterTypes[i]).filter(t => !!t)
1676116761
usageTypes.splice(0, 0, ...argumentTypes);
1676216762
});
1676316763
return usageTypes.length ? usageTypes : undefined;

0 commit comments

Comments
 (0)