mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-10 18:04:18 -05:00
More explicit error message for function signature length mismatches (#51457)
Co-authored-by: Jake Bailey <5341706+jakebailey@users.noreply.github.com>
This commit is contained in:
@@ -19812,6 +19812,11 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
const sourceHasMoreParameters = !hasEffectiveRestParameter(target) &&
|
||||
(checkMode & SignatureCheckMode.StrictArity ? hasEffectiveRestParameter(source) || getParameterCount(source) > targetCount : getMinArgumentCount(source) > targetCount);
|
||||
if (sourceHasMoreParameters) {
|
||||
if (reportErrors && !(checkMode & SignatureCheckMode.StrictArity)) {
|
||||
// the second condition should be redundant, because there is no error reporting when comparing signatures by strict arity
|
||||
// since it is only done for subtype reduction
|
||||
errorReporter!(Diagnostics.Target_signature_provides_too_few_arguments_Expected_0_or_more_but_got_1, getMinArgumentCount(source), targetCount);
|
||||
}
|
||||
return Ternary.False;
|
||||
}
|
||||
|
||||
|
||||
@@ -3619,6 +3619,10 @@
|
||||
"category": "Error",
|
||||
"code": 2848
|
||||
},
|
||||
"Target signature provides too few arguments. Expected {0} or more, but got {1}.": {
|
||||
"category": "Error",
|
||||
"code": 2849
|
||||
},
|
||||
|
||||
"Import declaration '{0}' is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
|
||||
Reference in New Issue
Block a user