@@ -10510,7 +10510,7 @@ namespace ts {
10510
10510
const signature = getSignatureFromDeclaration(node.parent);
10511
10511
const parameterIndex = node.parent.parameters.indexOf(node);
10512
10512
Debug.assert(parameterIndex >= 0);
10513
- return parameterIndex >= getMinArgumentCount(signature);
10513
+ return parameterIndex >= getMinArgumentCount(signature, /*strongArityForUntypedJS*/ true );
10514
10514
}
10515
10515
const iife = getImmediatelyInvokedFunctionExpression(node.parent);
10516
10516
if (iife) {
@@ -10601,6 +10601,9 @@ namespace ts {
10601
10601
isValueSignatureDeclaration(declaration) &&
10602
10602
!hasJSDocParameterTags(declaration) &&
10603
10603
!getJSDocType(declaration);
10604
+ if (isUntypedSignatureInJSFile) {
10605
+ flags |= SignatureFlags.IsUntypedSignatureInJSFile;
10606
+ }
10604
10607
10605
10608
// If this is a JSDoc construct signature, then skip the first parameter in the
10606
10609
// parameter list. The first parameter represents the return type of the construct
@@ -10631,7 +10634,6 @@ namespace ts {
10631
10634
const isOptionalParameter = isOptionalJSDocParameterTag(param) ||
10632
10635
param.initializer || param.questionToken || param.dotDotDotToken ||
10633
10636
iife && parameters.length > iife.arguments.length && !type ||
10634
- isUntypedSignatureInJSFile ||
10635
10637
isJSDocOptionalParameter(param);
10636
10638
if (!isOptionalParameter) {
10637
10639
minArgumentCount = parameters.length;
@@ -26375,7 +26377,7 @@ namespace ts {
26375
26377
return length;
26376
26378
}
26377
26379
26378
- function getMinArgumentCount(signature: Signature) {
26380
+ function getMinArgumentCount(signature: Signature, strongArityForUntypedJS?: boolean ) {
26379
26381
if (signatureHasRestParameter(signature)) {
26380
26382
const restType = getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]);
26381
26383
if (isTupleType(restType)) {
@@ -26385,6 +26387,9 @@ namespace ts {
26385
26387
}
26386
26388
}
26387
26389
}
26390
+ if (!strongArityForUntypedJS && signature.flags & SignatureFlags.IsUntypedSignatureInJSFile) {
26391
+ return 0;
26392
+ }
26388
26393
return signature.minArgumentCount;
26389
26394
}
26390
26395
0 commit comments