From de31ebecea2370a5419253a9ab2ee151c4ea1d85 Mon Sep 17 00:00:00 2001 From: Kevin Gibbons Date: Tue, 21 Mar 2023 09:09:22 -0700 Subject: [PATCH] More explicit error message for function signature length mismatches (#51457) Co-authored-by: Jake Bailey <5341706+jakebailey@users.noreply.github.com> --- src/compiler/checker.ts | 5 +++ src/compiler/diagnosticMessages.json | 4 +++ ...addMoreOverloadsToBaseSignature.errors.txt | 2 ++ .../arrowFunctionErrorSpan.errors.txt | 4 +++ ...ignaturesWithOptionalParameters.errors.txt | 14 ++++++++ ...ignaturesWithOptionalParameters.errors.txt | 10 ++++++ ...ignaturesWithOptionalParameters.errors.txt | 12 +++++++ .../assignmentCompatability44.errors.txt | 2 ++ .../assignmentCompatability45.errors.txt | 2 ++ .../reference/checkJsdocTypeTag6.errors.txt | 6 ++++ ...assCanExtendConstructorFunction.errors.txt | 2 ++ .../classSideInheritance3.errors.txt | 4 +++ .../reference/covariantCallbacks.errors.txt | 2 ++ .../derivedInterfaceCallSignature.errors.txt | 2 ++ ...functionConstraintSatisfaction2.errors.txt | 2 ++ ...lWithConstructorTypedArguments5.errors.txt | 4 +++ ...CallWithFunctionTypedArguments5.errors.txt | 4 +++ ...oadedConstructorTypedArguments2.errors.txt | 2 ++ ...erloadedFunctionTypedArguments2.errors.txt | 2 ++ .../reference/incompatibleTypes.errors.txt | 2 ++ .../reference/inferTypes1.errors.txt | 2 ++ .../reference/inheritance.errors.txt | 2 ++ .../reference/lambdaArgCrash.errors.txt | 2 ++ .../reference/multipleInheritance.errors.txt | 2 ++ ...ralFunctionArgContextualTyping2.errors.txt | 8 ++++- .../baselines/reference/parseTypes.errors.txt | 4 +++ ...AnnotatedFunctionInferenceError.errors.txt | 6 ++++ .../reference/promisePermutations.errors.txt | 32 +++++++++++++++++++ .../reference/promisePermutations2.errors.txt | 32 +++++++++++++++++++ .../reference/promisePermutations3.errors.txt | 32 +++++++++++++++++++ .../requiredInitializedParameter2.errors.txt | 2 ++ ...edTypeContextualTypeNotCircular.errors.txt | 2 ++ .../signatureLengthMismatchCall.errors.txt | 14 ++++++++ .../reference/signatureLengthMismatchCall.js | 13 ++++++++ .../signatureLengthMismatchCall.symbols | 14 ++++++++ .../signatureLengthMismatchCall.types | 16 ++++++++++ ...gnatureLengthMismatchInOverload.errors.txt | 27 ++++++++++++++++ .../signatureLengthMismatchInOverload.js | 11 +++++++ .../signatureLengthMismatchInOverload.symbols | 21 ++++++++++++ .../signatureLengthMismatchInOverload.types | 23 +++++++++++++ ...hMismatchWithOptionalParameters.errors.txt | 14 ++++++++ ...ureLengthMismatchWithOptionalParameters.js | 12 +++++++ ...ngthMismatchWithOptionalParameters.symbols | 15 +++++++++ ...LengthMismatchWithOptionalParameters.types | 16 ++++++++++ ...ignaturesWithOptionalParameters.errors.txt | 4 +++ ...ignaturesWithOptionalParameters.errors.txt | 4 +++ ...ignaturesWithOptionalParameters.errors.txt | 12 +++++++ ...ignaturesWithOptionalParameters.errors.txt | 12 +++++++ ...ionComponentsWithTypeArguments2.errors.txt | 2 ++ .../typeGuardFunctionErrors.errors.txt | 2 ++ .../compiler/signatureLengthMismatchCall.ts | 5 +++ .../signatureLengthMismatchInOverload.ts | 5 +++ ...ureLengthMismatchWithOptionalParameters.ts | 5 +++ 53 files changed, 459 insertions(+), 1 deletion(-) create mode 100644 tests/baselines/reference/signatureLengthMismatchCall.errors.txt create mode 100644 tests/baselines/reference/signatureLengthMismatchCall.js create mode 100644 tests/baselines/reference/signatureLengthMismatchCall.symbols create mode 100644 tests/baselines/reference/signatureLengthMismatchCall.types create mode 100644 tests/baselines/reference/signatureLengthMismatchInOverload.errors.txt create mode 100644 tests/baselines/reference/signatureLengthMismatchInOverload.js create mode 100644 tests/baselines/reference/signatureLengthMismatchInOverload.symbols create mode 100644 tests/baselines/reference/signatureLengthMismatchInOverload.types create mode 100644 tests/baselines/reference/signatureLengthMismatchWithOptionalParameters.errors.txt create mode 100644 tests/baselines/reference/signatureLengthMismatchWithOptionalParameters.js create mode 100644 tests/baselines/reference/signatureLengthMismatchWithOptionalParameters.symbols create mode 100644 tests/baselines/reference/signatureLengthMismatchWithOptionalParameters.types create mode 100644 tests/cases/compiler/signatureLengthMismatchCall.ts create mode 100644 tests/cases/compiler/signatureLengthMismatchInOverload.ts create mode 100644 tests/cases/compiler/signatureLengthMismatchWithOptionalParameters.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 2f9ad3e3304..6c0e83eb339 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -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; } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index f2211ff8a53..09f7f5254e7 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -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", diff --git a/tests/baselines/reference/addMoreOverloadsToBaseSignature.errors.txt b/tests/baselines/reference/addMoreOverloadsToBaseSignature.errors.txt index 4b6255688f8..dc6b00bdb8e 100644 --- a/tests/baselines/reference/addMoreOverloadsToBaseSignature.errors.txt +++ b/tests/baselines/reference/addMoreOverloadsToBaseSignature.errors.txt @@ -1,6 +1,7 @@ tests/cases/compiler/addMoreOverloadsToBaseSignature.ts(5,11): error TS2430: Interface 'Bar' incorrectly extends interface 'Foo'. Types of property 'f' are incompatible. Type '(key: string) => string' is not assignable to type '() => string'. + Target signature provides too few arguments. Expected 1 or more, but got 0. ==== tests/cases/compiler/addMoreOverloadsToBaseSignature.ts (1 errors) ==== @@ -13,6 +14,7 @@ tests/cases/compiler/addMoreOverloadsToBaseSignature.ts(5,11): error TS2430: Int !!! error TS2430: Interface 'Bar' incorrectly extends interface 'Foo'. !!! error TS2430: Types of property 'f' are incompatible. !!! error TS2430: Type '(key: string) => string' is not assignable to type '() => string'. +!!! error TS2430: Target signature provides too few arguments. Expected 1 or more, but got 0. f(key: string): string; } \ No newline at end of file diff --git a/tests/baselines/reference/arrowFunctionErrorSpan.errors.txt b/tests/baselines/reference/arrowFunctionErrorSpan.errors.txt index e258f56d5ed..07e49c757b6 100644 --- a/tests/baselines/reference/arrowFunctionErrorSpan.errors.txt +++ b/tests/baselines/reference/arrowFunctionErrorSpan.errors.txt @@ -8,6 +8,7 @@ tests/cases/compiler/arrowFunctionErrorSpan.ts(17,3): error TS2345: Argument of Type 'void' is not assignable to type 'number'. tests/cases/compiler/arrowFunctionErrorSpan.ts(18,5): error TS1200: Line terminator not permitted before arrow. tests/cases/compiler/arrowFunctionErrorSpan.ts(21,3): error TS2345: Argument of type '(a: any, b: any, c: any, d: any) => void' is not assignable to parameter of type '() => number'. + Target signature provides too few arguments. Expected 4 or more, but got 0. tests/cases/compiler/arrowFunctionErrorSpan.ts(28,7): error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'. Type 'void' is not assignable to type 'number'. tests/cases/compiler/arrowFunctionErrorSpan.ts(32,7): error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'. @@ -17,6 +18,7 @@ tests/cases/compiler/arrowFunctionErrorSpan.ts(36,7): error TS2345: Argument of tests/cases/compiler/arrowFunctionErrorSpan.ts(43,5): error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'. Type 'void' is not assignable to type 'number'. tests/cases/compiler/arrowFunctionErrorSpan.ts(52,3): error TS2345: Argument of type '(_: any) => number' is not assignable to parameter of type '() => number'. + Target signature provides too few arguments. Expected 1 or more, but got 0. ==== tests/cases/compiler/arrowFunctionErrorSpan.ts (11 errors) ==== @@ -64,6 +66,7 @@ tests/cases/compiler/arrowFunctionErrorSpan.ts(52,3): error TS2345: Argument of d) => { }); ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(a: any, b: any, c: any, d: any) => void' is not assignable to parameter of type '() => number'. +!!! error TS2345: Target signature provides too few arguments. Expected 4 or more, but got 0. // single line with a comment f(/* @@ -108,4 +111,5 @@ tests/cases/compiler/arrowFunctionErrorSpan.ts(52,3): error TS2345: Argument of 2); ~~~~~ !!! error TS2345: Argument of type '(_: any) => number' is not assignable to parameter of type '() => number'. +!!! error TS2345: Target signature provides too few arguments. Expected 1 or more, but got 0. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatWithCallSignaturesWithOptionalParameters.errors.txt b/tests/baselines/reference/assignmentCompatWithCallSignaturesWithOptionalParameters.errors.txt index f89bbfa5798..7f73c916eb8 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignaturesWithOptionalParameters.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithCallSignaturesWithOptionalParameters.errors.txt @@ -1,10 +1,17 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithOptionalParameters.ts(16,5): error TS2322: Type '(x: number) => number' is not assignable to type '() => number'. + Target signature provides too few arguments. Expected 1 or more, but got 0. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithOptionalParameters.ts(19,5): error TS2322: Type '(x: number) => number' is not assignable to type '() => number'. + Target signature provides too few arguments. Expected 1 or more, but got 0. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithOptionalParameters.ts(20,5): error TS2322: Type '(x: number, y?: number) => number' is not assignable to type '() => number'. + Target signature provides too few arguments. Expected 1 or more, but got 0. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithOptionalParameters.ts(22,5): error TS2322: Type '(x: number, y: number) => number' is not assignable to type '() => number'. + Target signature provides too few arguments. Expected 2 or more, but got 0. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithOptionalParameters.ts(33,5): error TS2322: Type '(x: number, y: number) => number' is not assignable to type '(x?: number) => number'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithOptionalParameters.ts(39,5): error TS2322: Type '(x: number, y: number) => number' is not assignable to type '(x: number) => number'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithOptionalParameters.ts(45,5): error TS2322: Type '(x: number, y: number) => number' is not assignable to type '(x: number) => number'. + Target signature provides too few arguments. Expected 2 or more, but got 1. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithOptionalParameters.ts (7 errors) ==== @@ -26,18 +33,22 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme a = (x: number) => 1; // error, too many required params ~ !!! error TS2322: Type '(x: number) => number' is not assignable to type '() => number'. +!!! error TS2322: Target signature provides too few arguments. Expected 1 or more, but got 0. a = b.a; // ok a = b.a2; // ok a = b.a3; // error ~ !!! error TS2322: Type '(x: number) => number' is not assignable to type '() => number'. +!!! error TS2322: Target signature provides too few arguments. Expected 1 or more, but got 0. a = b.a4; // error ~ !!! error TS2322: Type '(x: number, y?: number) => number' is not assignable to type '() => number'. +!!! error TS2322: Target signature provides too few arguments. Expected 1 or more, but got 0. a = b.a5; // ok a = b.a6; // error ~ !!! error TS2322: Type '(x: number, y: number) => number' is not assignable to type '() => number'. +!!! error TS2322: Target signature provides too few arguments. Expected 2 or more, but got 0. var a2: (x?: number) => number; a2 = () => 1; // ok, same number of required params @@ -51,6 +62,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme a2 = b.a6; // error ~~ !!! error TS2322: Type '(x: number, y: number) => number' is not assignable to type '(x?: number) => number'. +!!! error TS2322: Target signature provides too few arguments. Expected 2 or more, but got 1. var a3: (x: number) => number; a3 = () => 1; // ok, fewer required params @@ -59,6 +71,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme a3 = (x: number, y: number) => 1; // error, too many required params ~~ !!! error TS2322: Type '(x: number, y: number) => number' is not assignable to type '(x: number) => number'. +!!! error TS2322: Target signature provides too few arguments. Expected 2 or more, but got 1. a3 = b.a; // ok a3 = b.a2; // ok a3 = b.a3; // ok @@ -67,6 +80,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme a3 = b.a6; // error ~~ !!! error TS2322: Type '(x: number, y: number) => number' is not assignable to type '(x: number) => number'. +!!! error TS2322: Target signature provides too few arguments. Expected 2 or more, but got 1. var a4: (x: number, y?: number) => number; a4 = () => 1; // ok, fewer required params diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignaturesWithOptionalParameters.errors.txt b/tests/baselines/reference/assignmentCompatWithConstructSignaturesWithOptionalParameters.errors.txt index df56af3ee98..236c5191f8d 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignaturesWithOptionalParameters.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithConstructSignaturesWithOptionalParameters.errors.txt @@ -1,8 +1,13 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignaturesWithOptionalParameters.ts(16,5): error TS2322: Type 'new (x: number) => number' is not assignable to type 'new () => number'. + Target signature provides too few arguments. Expected 1 or more, but got 0. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignaturesWithOptionalParameters.ts(17,5): error TS2322: Type 'new (x: number, y?: number) => number' is not assignable to type 'new () => number'. + Target signature provides too few arguments. Expected 1 or more, but got 0. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignaturesWithOptionalParameters.ts(19,5): error TS2322: Type 'new (x: number, y: number) => number' is not assignable to type 'new () => number'. + Target signature provides too few arguments. Expected 2 or more, but got 0. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignaturesWithOptionalParameters.ts(27,5): error TS2322: Type 'new (x: number, y: number) => number' is not assignable to type 'new (x?: number) => number'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignaturesWithOptionalParameters.ts(35,5): error TS2322: Type 'new (x: number, y: number) => number' is not assignable to type 'new (x: number) => number'. + Target signature provides too few arguments. Expected 2 or more, but got 1. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignaturesWithOptionalParameters.ts (5 errors) ==== @@ -24,13 +29,16 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme a = b.a3; // error ~ !!! error TS2322: Type 'new (x: number) => number' is not assignable to type 'new () => number'. +!!! error TS2322: Target signature provides too few arguments. Expected 1 or more, but got 0. a = b.a4; // error ~ !!! error TS2322: Type 'new (x: number, y?: number) => number' is not assignable to type 'new () => number'. +!!! error TS2322: Target signature provides too few arguments. Expected 1 or more, but got 0. a = b.a5; // ok a = b.a6; // error ~ !!! error TS2322: Type 'new (x: number, y: number) => number' is not assignable to type 'new () => number'. +!!! error TS2322: Target signature provides too few arguments. Expected 2 or more, but got 0. var a2: new (x?: number) => number; a2 = b.a; // ok @@ -41,6 +49,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme a2 = b.a6; // error ~~ !!! error TS2322: Type 'new (x: number, y: number) => number' is not assignable to type 'new (x?: number) => number'. +!!! error TS2322: Target signature provides too few arguments. Expected 2 or more, but got 1. var a3: new (x: number) => number; a3 = b.a; // ok @@ -51,6 +60,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme a3 = b.a6; // error ~~ !!! error TS2322: Type 'new (x: number, y: number) => number' is not assignable to type 'new (x: number) => number'. +!!! error TS2322: Target signature provides too few arguments. Expected 2 or more, but got 1. var a4: new (x: number, y?: number) => number; a4 = b.a; // ok diff --git a/tests/baselines/reference/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.errors.txt b/tests/baselines/reference/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.errors.txt index e6abee1ecff..51b59d71176 100644 --- a/tests/baselines/reference/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.errors.txt @@ -1,5 +1,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(14,13): error TS2322: Type '(x: T) => any' is not assignable to type '() => T'. + Target signature provides too few arguments. Expected 1 or more, but got 0. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(23,13): error TS2322: Type '(x: T, y: T) => any' is not assignable to type '(x: T) => T'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(63,9): error TS2322: Type '() => T' is not assignable to type '() => T'. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. 'T' could be instantiated with an arbitrary type which could be unrelated to 'T'. @@ -7,7 +9,9 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. 'T' could be instantiated with an arbitrary type which could be unrelated to 'T'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(65,9): error TS2322: Type '(x: T) => T' is not assignable to type '() => T'. + Target signature provides too few arguments. Expected 1 or more, but got 0. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(66,9): error TS2322: Type '(x: T, y?: T) => T' is not assignable to type '() => T'. + Target signature provides too few arguments. Expected 1 or more, but got 0. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(67,9): error TS2322: Type '(x?: T, y?: T) => T' is not assignable to type '() => T'. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. 'T' could be instantiated with an arbitrary type which could be unrelated to 'T'. @@ -88,7 +92,9 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. 'T' could be instantiated with an arbitrary type which could be unrelated to 'T'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(107,13): error TS2322: Type '(x: T) => any' is not assignable to type '() => T'. + Target signature provides too few arguments. Expected 1 or more, but got 0. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(116,13): error TS2322: Type '(x: T, y: T) => any' is not assignable to type '(x: T) => T'. + Target signature provides too few arguments. Expected 2 or more, but got 1. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts (29 errors) ==== @@ -108,6 +114,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme this.a = (x: T) => null; // error, too many required params ~~~~~~ !!! error TS2322: Type '(x: T) => any' is not assignable to type '() => T'. +!!! error TS2322: Target signature provides too few arguments. Expected 1 or more, but got 0. this.a2 = () => null; // ok, same T of required params this.a2 = (x?: T) => null; // ok, same T of required params @@ -119,6 +126,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme this.a3 = (x: T, y: T) => null; // error, too many required params ~~~~~~~ !!! error TS2322: Type '(x: T, y: T) => any' is not assignable to type '(x: T) => T'. +!!! error TS2322: Target signature provides too few arguments. Expected 2 or more, but got 1. this.a4 = () => null; // ok, fewer required params this.a4 = (x?: T, y?: T) => null; // ok, fewer required params @@ -173,9 +181,11 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme b.a = t.a3; ~~~ !!! error TS2322: Type '(x: T) => T' is not assignable to type '() => T'. +!!! error TS2322: Target signature provides too few arguments. Expected 1 or more, but got 0. b.a = t.a4; ~~~ !!! error TS2322: Type '(x: T, y?: T) => T' is not assignable to type '() => T'. +!!! error TS2322: Target signature provides too few arguments. Expected 1 or more, but got 0. b.a = t.a5; ~~~ !!! error TS2322: Type '(x?: T, y?: T) => T' is not assignable to type '() => T'. @@ -340,6 +350,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme this.a = (x: T) => null; // error, too many required params ~~~~~~ !!! error TS2322: Type '(x: T) => any' is not assignable to type '() => T'. +!!! error TS2322: Target signature provides too few arguments. Expected 1 or more, but got 0. this.a2 = () => null; // ok, same T of required params this.a2 = (x?: T) => null; // ok, same T of required params @@ -351,6 +362,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme this.a3 = (x: T, y: T) => null; // error, too many required params ~~~~~~~ !!! error TS2322: Type '(x: T, y: T) => any' is not assignable to type '(x: T) => T'. +!!! error TS2322: Target signature provides too few arguments. Expected 2 or more, but got 1. this.a4 = () => null; // ok, fewer required params this.a4 = (x?: T, y?: T) => null; // ok, fewer required params diff --git a/tests/baselines/reference/assignmentCompatability44.errors.txt b/tests/baselines/reference/assignmentCompatability44.errors.txt index 65cd1826acc..030b8c5da1e 100644 --- a/tests/baselines/reference/assignmentCompatability44.errors.txt +++ b/tests/baselines/reference/assignmentCompatability44.errors.txt @@ -1,6 +1,7 @@ tests/cases/compiler/assignmentCompatability44.ts(5,7): error TS2322: Type 'typeof Foo' is not assignable to type 'new () => Foo'. Types of construct signatures are incompatible. Type 'new (x: number) => Foo' is not assignable to type 'new () => Foo'. + Target signature provides too few arguments. Expected 1 or more, but got 0. ==== tests/cases/compiler/assignmentCompatability44.ts (1 errors) ==== @@ -13,4 +14,5 @@ tests/cases/compiler/assignmentCompatability44.ts(5,7): error TS2322: Type 'type !!! error TS2322: Type 'typeof Foo' is not assignable to type 'new () => Foo'. !!! error TS2322: Types of construct signatures are incompatible. !!! error TS2322: Type 'new (x: number) => Foo' is not assignable to type 'new () => Foo'. +!!! error TS2322: Target signature provides too few arguments. Expected 1 or more, but got 0. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatability45.errors.txt b/tests/baselines/reference/assignmentCompatability45.errors.txt index af0170320bd..a21de76d3db 100644 --- a/tests/baselines/reference/assignmentCompatability45.errors.txt +++ b/tests/baselines/reference/assignmentCompatability45.errors.txt @@ -1,6 +1,7 @@ tests/cases/compiler/assignmentCompatability45.ts(7,7): error TS2322: Type 'typeof B' is not assignable to type 'typeof A'. Types of construct signatures are incompatible. Type 'new (x: number) => B' is not assignable to type 'abstract new () => A'. + Target signature provides too few arguments. Expected 1 or more, but got 0. ==== tests/cases/compiler/assignmentCompatability45.ts (1 errors) ==== @@ -15,4 +16,5 @@ tests/cases/compiler/assignmentCompatability45.ts(7,7): error TS2322: Type 'type !!! error TS2322: Type 'typeof B' is not assignable to type 'typeof A'. !!! error TS2322: Types of construct signatures are incompatible. !!! error TS2322: Type 'new (x: number) => B' is not assignable to type 'abstract new () => A'. +!!! error TS2322: Target signature provides too few arguments. Expected 1 or more, but got 0. \ No newline at end of file diff --git a/tests/baselines/reference/checkJsdocTypeTag6.errors.txt b/tests/baselines/reference/checkJsdocTypeTag6.errors.txt index 605ddad823a..762128117ce 100644 --- a/tests/baselines/reference/checkJsdocTypeTag6.errors.txt +++ b/tests/baselines/reference/checkJsdocTypeTag6.errors.txt @@ -3,8 +3,11 @@ tests/cases/conformance/jsdoc/test.js(7,5): error TS2322: Type '(prop: any) => v tests/cases/conformance/jsdoc/test.js(10,12): error TS8030: The type of a function declaration must match the function's signature. tests/cases/conformance/jsdoc/test.js(23,12): error TS8030: The type of a function declaration must match the function's signature. tests/cases/conformance/jsdoc/test.js(27,7): error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. + Target signature provides too few arguments. Expected 1 or more, but got 0. tests/cases/conformance/jsdoc/test.js(30,7): error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. + Target signature provides too few arguments. Expected 1 or more, but got 0. tests/cases/conformance/jsdoc/test.js(34,3): error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. + Target signature provides too few arguments. Expected 1 or more, but got 0. ==== tests/cases/conformance/jsdoc/test.js (7 errors) ==== @@ -45,16 +48,19 @@ tests/cases/conformance/jsdoc/test.js(34,3): error TS2322: Type '(more: any) => const variableWithMoreParameters = function (more) {}; // error ~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. +!!! error TS2322: Target signature provides too few arguments. Expected 1 or more, but got 0. /** @type {() => void} */ const arrowWithMoreParameters = (more) => {}; // error ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. +!!! error TS2322: Target signature provides too few arguments. Expected 1 or more, but got 0. ({ /** @type {() => void} */ methodWithMoreParameters(more) {}, // error ~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type '(more: any) => void' is not assignable to type '() => void'. +!!! error TS2322: Target signature provides too few arguments. Expected 1 or more, but got 0. }); \ No newline at end of file diff --git a/tests/baselines/reference/classCanExtendConstructorFunction.errors.txt b/tests/baselines/reference/classCanExtendConstructorFunction.errors.txt index 1fd6c25a714..549ea32ebb2 100644 --- a/tests/baselines/reference/classCanExtendConstructorFunction.errors.txt +++ b/tests/baselines/reference/classCanExtendConstructorFunction.errors.txt @@ -1,6 +1,7 @@ tests/cases/conformance/salsa/first.js(23,9): error TS2554: Expected 1 arguments, but got 0. tests/cases/conformance/salsa/first.js(31,5): error TS2416: Property 'load' in type 'Sql' is not assignable to the same property in base type 'Wagon'. Type '(files: string[], format: "csv" | "json" | "xmlolololol") => void' is not assignable to type '(supplies?: any[]) => void'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/conformance/salsa/first.js(47,24): error TS2507: Type '(numberEaten: number) => void' is not a constructor function type. tests/cases/conformance/salsa/generic.js(19,19): error TS2554: Expected 1 arguments, but got 0. tests/cases/conformance/salsa/generic.js(20,32): error TS2345: Argument of type 'number' is not assignable to parameter of type '{ claim: "ignorant" | "malicious"; }'. @@ -52,6 +53,7 @@ tests/cases/conformance/salsa/second.ts(17,15): error TS2345: Argument of type ' ~~~~ !!! error TS2416: Property 'load' in type 'Sql' is not assignable to the same property in base type 'Wagon'. !!! error TS2416: Type '(files: string[], format: "csv" | "json" | "xmlolololol") => void' is not assignable to type '(supplies?: any[]) => void'. +!!! error TS2416: Target signature provides too few arguments. Expected 2 or more, but got 1. if (format === "xmlolololol") { throw new Error("please do not use XML. It was a joke."); } diff --git a/tests/baselines/reference/classSideInheritance3.errors.txt b/tests/baselines/reference/classSideInheritance3.errors.txt index cdad6599715..3a973835e7f 100644 --- a/tests/baselines/reference/classSideInheritance3.errors.txt +++ b/tests/baselines/reference/classSideInheritance3.errors.txt @@ -1,9 +1,11 @@ tests/cases/compiler/classSideInheritance3.ts(16,5): error TS2322: Type 'typeof B' is not assignable to type 'typeof A'. Types of construct signatures are incompatible. Type 'new (x: string, data: string) => B' is not assignable to type 'new (x: string) => A'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/classSideInheritance3.ts(17,5): error TS2322: Type 'typeof B' is not assignable to type 'new (x: string) => A'. Types of construct signatures are incompatible. Type 'new (x: string, data: string) => B' is not assignable to type 'new (x: string) => A'. + Target signature provides too few arguments. Expected 2 or more, but got 1. ==== tests/cases/compiler/classSideInheritance3.ts (2 errors) ==== @@ -27,9 +29,11 @@ tests/cases/compiler/classSideInheritance3.ts(17,5): error TS2322: Type 'typeof !!! error TS2322: Type 'typeof B' is not assignable to type 'typeof A'. !!! error TS2322: Types of construct signatures are incompatible. !!! error TS2322: Type 'new (x: string, data: string) => B' is not assignable to type 'new (x: string) => A'. +!!! error TS2322: Target signature provides too few arguments. Expected 2 or more, but got 1. var r2: new (x: string) => A = B; // error ~~ !!! error TS2322: Type 'typeof B' is not assignable to type 'new (x: string) => A'. !!! error TS2322: Types of construct signatures are incompatible. !!! error TS2322: Type 'new (x: string, data: string) => B' is not assignable to type 'new (x: string) => A'. +!!! error TS2322: Target signature provides too few arguments. Expected 2 or more, but got 1. var r3: typeof A = C; // ok \ No newline at end of file diff --git a/tests/baselines/reference/covariantCallbacks.errors.txt b/tests/baselines/reference/covariantCallbacks.errors.txt index 401bf454baa..19edd9745b4 100644 --- a/tests/baselines/reference/covariantCallbacks.errors.txt +++ b/tests/baselines/reference/covariantCallbacks.errors.txt @@ -16,6 +16,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/covarian Types of property 'forEach' are incompatible. Type '(cb: (item: A) => void) => void' is not assignable to type '(cb: (item: A, context: any) => void) => void'. Types of parameters 'cb' and 'cb' are incompatible. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/covariantCallbacks.ts(69,5): error TS2322: Type 'AList4' is not assignable to type 'BList4'. Types of property 'forEach' are incompatible. Type '(cb: (item: A) => A) => void' is not assignable to type '(cb: (item: B) => B) => void'. @@ -105,6 +106,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/covarian !!! error TS2322: Types of property 'forEach' are incompatible. !!! error TS2322: Type '(cb: (item: A) => void) => void' is not assignable to type '(cb: (item: A, context: any) => void) => void'. !!! error TS2322: Types of parameters 'cb' and 'cb' are incompatible. +!!! error TS2322: Target signature provides too few arguments. Expected 2 or more, but got 1. } interface AList4 { diff --git a/tests/baselines/reference/derivedInterfaceCallSignature.errors.txt b/tests/baselines/reference/derivedInterfaceCallSignature.errors.txt index ae8fbe2ff5d..e40fd10ed14 100644 --- a/tests/baselines/reference/derivedInterfaceCallSignature.errors.txt +++ b/tests/baselines/reference/derivedInterfaceCallSignature.errors.txt @@ -1,6 +1,7 @@ tests/cases/compiler/derivedInterfaceCallSignature.ts(11,11): error TS2430: Interface 'D3SvgArea' incorrectly extends interface 'D3SvgPath'. Types of property 'x' are incompatible. Type '(x: (data: any, index?: number) => number) => D3SvgArea' is not assignable to type '() => (data: any, index?: number) => number'. + Target signature provides too few arguments. Expected 1 or more, but got 0. ==== tests/cases/compiler/derivedInterfaceCallSignature.ts (1 errors) ==== @@ -19,6 +20,7 @@ tests/cases/compiler/derivedInterfaceCallSignature.ts(11,11): error TS2430: Inte !!! error TS2430: Interface 'D3SvgArea' incorrectly extends interface 'D3SvgPath'. !!! error TS2430: Types of property 'x' are incompatible. !!! error TS2430: Type '(x: (data: any, index?: number) => number) => D3SvgArea' is not assignable to type '() => (data: any, index?: number) => number'. +!!! error TS2430: Target signature provides too few arguments. Expected 1 or more, but got 0. x(x: (data: any, index?: number) => number): D3SvgArea; y(y: (data: any, index?: number) => number): D3SvgArea; y0(): (data: any, index?: number) => number; diff --git a/tests/baselines/reference/functionConstraintSatisfaction2.errors.txt b/tests/baselines/reference/functionConstraintSatisfaction2.errors.txt index 3914831c26b..df8c39dbaa6 100644 --- a/tests/baselines/reference/functionConstraintSatisfaction2.errors.txt +++ b/tests/baselines/reference/functionConstraintSatisfaction2.errors.txt @@ -11,6 +11,7 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(26,15): error TS2345: Argument of type 'new (x: string) => string' is not assignable to parameter of type '(x: string) => string'. Type 'new (x: string) => string' provides no match for the signature '(x: string): string'. tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(28,16): error TS2345: Argument of type '(x: U, y: V) => U' is not assignable to parameter of type '(x: string) => string'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(29,16): error TS2345: Argument of type 'typeof C2' is not assignable to parameter of type '(x: string) => string'. Type 'typeof C2' provides no match for the signature '(x: string): string'. tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(30,16): error TS2345: Argument of type 'new (x: T) => T' is not assignable to parameter of type '(x: string) => string'. @@ -74,6 +75,7 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain var r11 = foo2((x: U, y: V) => x); ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: U, y: V) => U' is not assignable to parameter of type '(x: string) => string'. +!!! error TS2345: Target signature provides too few arguments. Expected 2 or more, but got 1. var r13 = foo2(C2); ~~ !!! error TS2345: Argument of type 'typeof C2' is not assignable to parameter of type '(x: string) => string'. diff --git a/tests/baselines/reference/genericCallWithConstructorTypedArguments5.errors.txt b/tests/baselines/reference/genericCallWithConstructorTypedArguments5.errors.txt index fe2d76b23de..9520345d861 100644 --- a/tests/baselines/reference/genericCallWithConstructorTypedArguments5.errors.txt +++ b/tests/baselines/reference/genericCallWithConstructorTypedArguments5.errors.txt @@ -1,9 +1,11 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstructorTypedArguments5.ts(11,14): error TS2345: Argument of type '{ cb: new (x: T, y: T) => string; }' is not assignable to parameter of type '{ cb: new (t: unknown) => string; }'. Types of property 'cb' are incompatible. Type 'new (x: T, y: T) => string' is not assignable to type 'new (t: unknown) => string'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstructorTypedArguments5.ts(13,14): error TS2345: Argument of type '{ cb: new (x: string, y: number) => string; }' is not assignable to parameter of type '{ cb: new (t: string) => string; }'. Types of property 'cb' are incompatible. Type 'new (x: string, y: number) => string' is not assignable to type 'new (t: string) => string'. + Target signature provides too few arguments. Expected 2 or more, but got 1. ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstructorTypedArguments5.ts (2 errors) ==== @@ -22,12 +24,14 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithCon !!! error TS2345: Argument of type '{ cb: new (x: T, y: T) => string; }' is not assignable to parameter of type '{ cb: new (t: unknown) => string; }'. !!! error TS2345: Types of property 'cb' are incompatible. !!! error TS2345: Type 'new (x: T, y: T) => string' is not assignable to type 'new (t: unknown) => string'. +!!! error TS2345: Target signature provides too few arguments. Expected 2 or more, but got 1. var arg3: { cb: new (x: string, y: number) => string }; var r3 = foo(arg3); // error ~~~~ !!! error TS2345: Argument of type '{ cb: new (x: string, y: number) => string; }' is not assignable to parameter of type '{ cb: new (t: string) => string; }'. !!! error TS2345: Types of property 'cb' are incompatible. !!! error TS2345: Type 'new (x: string, y: number) => string' is not assignable to type 'new (t: string) => string'. +!!! error TS2345: Target signature provides too few arguments. Expected 2 or more, but got 1. function foo2(arg: { cb: new(t: T, t2: T) => U }) { return new arg.cb(null, null); diff --git a/tests/baselines/reference/genericCallWithFunctionTypedArguments5.errors.txt b/tests/baselines/reference/genericCallWithFunctionTypedArguments5.errors.txt index 9af10d79a7d..55b524472d7 100644 --- a/tests/baselines/reference/genericCallWithFunctionTypedArguments5.errors.txt +++ b/tests/baselines/reference/genericCallWithFunctionTypedArguments5.errors.txt @@ -1,5 +1,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments5.ts(10,16): error TS2322: Type '(x: T, y: T) => string' is not assignable to type '(t: unknown) => string'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments5.ts(11,16): error TS2322: Type '(x: string, y: number) => string' is not assignable to type '(t: string) => string'. + Target signature provides too few arguments. Expected 2 or more, but got 1. ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments5.ts (2 errors) ==== @@ -15,10 +17,12 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun var r2 = foo({ cb: (x: T, y: T) => '' }); // error ~~ !!! error TS2322: Type '(x: T, y: T) => string' is not assignable to type '(t: unknown) => string'. +!!! error TS2322: Target signature provides too few arguments. Expected 2 or more, but got 1. !!! related TS6500 tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments5.ts:3:27: The expected type comes from property 'cb' which is declared here on type '{ cb: (t: unknown) => string; }' var r3 = foo({ cb: (x: string, y: number) => '' }); // error ~~ !!! error TS2322: Type '(x: string, y: number) => string' is not assignable to type '(t: string) => string'. +!!! error TS2322: Target signature provides too few arguments. Expected 2 or more, but got 1. !!! related TS6500 tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments5.ts:3:27: The expected type comes from property 'cb' which is declared here on type '{ cb: (t: string) => string; }' function foo2(arg: { cb: (t: T, t2: T) => U }) { diff --git a/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments2.errors.txt b/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments2.errors.txt index 2e52a9d482c..c1384d44f76 100644 --- a/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments2.errors.txt +++ b/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments2.errors.txt @@ -1,4 +1,5 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithOverloadedConstructorTypedArguments2.ts(31,20): error TS2345: Argument of type 'new (x: T, y: T) => string' is not assignable to parameter of type '{ new (x: unknown): string; new (x: unknown, y?: unknown): string; }'. + Target signature provides too few arguments. Expected 2 or more, but got 1. ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithOverloadedConstructorTypedArguments2.ts (1 errors) ==== @@ -35,6 +36,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithOve var r10 = foo6(b); // error ~ !!! error TS2345: Argument of type 'new (x: T, y: T) => string' is not assignable to parameter of type '{ new (x: unknown): string; new (x: unknown, y?: unknown): string; }'. +!!! error TS2345: Target signature provides too few arguments. Expected 2 or more, but got 1. function foo7(x:T, cb: { new(x: T): string; new(x: T, y?: T): string }) { return cb; diff --git a/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments2.errors.txt b/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments2.errors.txt index 2e5b19bcf1b..21e85361521 100644 --- a/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments2.errors.txt +++ b/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments2.errors.txt @@ -1,4 +1,5 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithOverloadedFunctionTypedArguments2.ts(28,20): error TS2345: Argument of type '(x: T, y: T) => string' is not assignable to parameter of type '{ (x: unknown): string; (x: unknown, y?: unknown): string; }'. + Target signature provides too few arguments. Expected 2 or more, but got 1. ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithOverloadedFunctionTypedArguments2.ts (1 errors) ==== @@ -32,6 +33,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithOve var r10 = foo6((x: T, y: T) => ''); // error ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: T, y: T) => string' is not assignable to parameter of type '{ (x: unknown): string; (x: unknown, y?: unknown): string; }'. +!!! error TS2345: Target signature provides too few arguments. Expected 2 or more, but got 1. function foo7(x:T, cb: { (x: T): string; (x: T, y?: T): string }) { return cb; diff --git a/tests/baselines/reference/incompatibleTypes.errors.txt b/tests/baselines/reference/incompatibleTypes.errors.txt index ffee3cebb1a..4ebfde3786e 100644 --- a/tests/baselines/reference/incompatibleTypes.errors.txt +++ b/tests/baselines/reference/incompatibleTypes.errors.txt @@ -29,6 +29,7 @@ tests/cases/compiler/incompatibleTypes.ts(66,47): error TS2322: Type '{ e: numbe Object literal may only specify known properties, and 'e' does not exist in type '{ a: { a: string; }; b: string; }'. tests/cases/compiler/incompatibleTypes.ts(72,5): error TS2322: Type 'number' is not assignable to type '() => string'. tests/cases/compiler/incompatibleTypes.ts(74,5): error TS2322: Type '(a: any) => number' is not assignable to type '() => any'. + Target signature provides too few arguments. Expected 1 or more, but got 0. ==== tests/cases/compiler/incompatibleTypes.ts (9 errors) ==== @@ -148,4 +149,5 @@ tests/cases/compiler/incompatibleTypes.ts(74,5): error TS2322: Type '(a: any) => var fp1: () =>any = a => 0; ~~~ !!! error TS2322: Type '(a: any) => number' is not assignable to type '() => any'. +!!! error TS2322: Target signature provides too few arguments. Expected 1 or more, but got 0. \ No newline at end of file diff --git a/tests/baselines/reference/inferTypes1.errors.txt b/tests/baselines/reference/inferTypes1.errors.txt index 5e7c4bfebb5..97215b543bb 100644 --- a/tests/baselines/reference/inferTypes1.errors.txt +++ b/tests/baselines/reference/inferTypes1.errors.txt @@ -5,6 +5,7 @@ tests/cases/conformance/types/conditional/inferTypes1.ts(43,25): error TS2344: T tests/cases/conformance/types/conditional/inferTypes1.ts(44,25): error TS2344: Type 'Function' does not satisfy the constraint 'abstract new (...args: any) => any'. Type 'Function' provides no match for the signature 'new (...args: any): any'. tests/cases/conformance/types/conditional/inferTypes1.ts(55,25): error TS2344: Type '(x: string, y: string) => number' does not satisfy the constraint '(x: any) => any'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/conformance/types/conditional/inferTypes1.ts(56,25): error TS2344: Type 'Function' does not satisfy the constraint '(x: any) => any'. Type 'Function' provides no match for the signature '(x: any): any'. tests/cases/conformance/types/conditional/inferTypes1.ts(82,12): error TS1338: 'infer' declarations are only permitted in the 'extends' clause of a conditional type. @@ -88,6 +89,7 @@ tests/cases/conformance/types/conditional/inferTypes1.ts(153,40): error TS2322: type T24 = ArgumentType<(x: string, y: string) => number>; // Error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2344: Type '(x: string, y: string) => number' does not satisfy the constraint '(x: any) => any'. +!!! error TS2344: Target signature provides too few arguments. Expected 2 or more, but got 1. type T25 = ArgumentType; // Error ~~~~~~~~ !!! error TS2344: Type 'Function' does not satisfy the constraint '(x: any) => any'. diff --git a/tests/baselines/reference/inheritance.errors.txt b/tests/baselines/reference/inheritance.errors.txt index b476f1399b4..b29966fba8d 100644 --- a/tests/baselines/reference/inheritance.errors.txt +++ b/tests/baselines/reference/inheritance.errors.txt @@ -1,6 +1,7 @@ tests/cases/compiler/inheritance.ts(31,12): error TS2425: Class 'Good' defines instance member property 'f', but extended class 'Baad' defines it as instance member function. tests/cases/compiler/inheritance.ts(32,12): error TS2416: Property 'g' in type 'Baad' is not assignable to the same property in base type 'Good'. Type '(n: number) => number' is not assignable to type '() => number'. + Target signature provides too few arguments. Expected 1 or more, but got 0. ==== tests/cases/compiler/inheritance.ts (2 errors) ==== @@ -41,5 +42,6 @@ tests/cases/compiler/inheritance.ts(32,12): error TS2416: Property 'g' in type ' ~ !!! error TS2416: Property 'g' in type 'Baad' is not assignable to the same property in base type 'Good'. !!! error TS2416: Type '(n: number) => number' is not assignable to type '() => number'. +!!! error TS2416: Target signature provides too few arguments. Expected 1 or more, but got 0. } \ No newline at end of file diff --git a/tests/baselines/reference/lambdaArgCrash.errors.txt b/tests/baselines/reference/lambdaArgCrash.errors.txt index 1ca180c7937..560dde9bb7a 100644 --- a/tests/baselines/reference/lambdaArgCrash.errors.txt +++ b/tests/baselines/reference/lambdaArgCrash.errors.txt @@ -1,5 +1,6 @@ tests/cases/compiler/lambdaArgCrash.ts(27,25): error TS2304: Cannot find name 'ItemSet'. tests/cases/compiler/lambdaArgCrash.ts(29,14): error TS2345: Argument of type '(items: ItemSet) => void' is not assignable to parameter of type '() => any'. + Target signature provides too few arguments. Expected 1 or more, but got 0. ==== tests/cases/compiler/lambdaArgCrash.ts (2 errors) ==== @@ -36,6 +37,7 @@ tests/cases/compiler/lambdaArgCrash.ts(29,14): error TS2345: Argument of type '( super.add(listener); ~~~~~~~~ !!! error TS2345: Argument of type '(items: ItemSet) => void' is not assignable to parameter of type '() => any'. +!!! error TS2345: Target signature provides too few arguments. Expected 1 or more, but got 0. } diff --git a/tests/baselines/reference/multipleInheritance.errors.txt b/tests/baselines/reference/multipleInheritance.errors.txt index c4a440d9a0e..133d9a697e7 100644 --- a/tests/baselines/reference/multipleInheritance.errors.txt +++ b/tests/baselines/reference/multipleInheritance.errors.txt @@ -3,6 +3,7 @@ tests/cases/compiler/multipleInheritance.ts(18,21): error TS1174: Classes can on tests/cases/compiler/multipleInheritance.ts(35,12): error TS2425: Class 'Good' defines instance member property 'f', but extended class 'Baad' defines it as instance member function. tests/cases/compiler/multipleInheritance.ts(36,12): error TS2416: Property 'g' in type 'Baad' is not assignable to the same property in base type 'Good'. Type '(n: number) => number' is not assignable to type '() => number'. + Target signature provides too few arguments. Expected 1 or more, but got 0. ==== tests/cases/compiler/multipleInheritance.ts (4 errors) ==== @@ -51,5 +52,6 @@ tests/cases/compiler/multipleInheritance.ts(36,12): error TS2416: Property 'g' i ~ !!! error TS2416: Property 'g' in type 'Baad' is not assignable to the same property in base type 'Good'. !!! error TS2416: Type '(n: number) => number' is not assignable to type '() => number'. +!!! error TS2416: Target signature provides too few arguments. Expected 1 or more, but got 0. } \ No newline at end of file diff --git a/tests/baselines/reference/objectLiteralFunctionArgContextualTyping2.errors.txt b/tests/baselines/reference/objectLiteralFunctionArgContextualTyping2.errors.txt index 2d963271983..f6645716915 100644 --- a/tests/baselines/reference/objectLiteralFunctionArgContextualTyping2.errors.txt +++ b/tests/baselines/reference/objectLiteralFunctionArgContextualTyping2.errors.txt @@ -5,8 +5,11 @@ tests/cases/compiler/objectLiteralFunctionArgContextualTyping2.ts(9,4): error TS tests/cases/compiler/objectLiteralFunctionArgContextualTyping2.ts(10,17): error TS2345: Argument of type '{ value: string; what: number; }' is not assignable to parameter of type 'I2'. Object literal may only specify known properties, and 'what' does not exist in type 'I2'. tests/cases/compiler/objectLiteralFunctionArgContextualTyping2.ts(11,6): error TS2322: Type '(s: any) => any' is not assignable to type '() => string'. + Target signature provides too few arguments. Expected 1 or more, but got 0. tests/cases/compiler/objectLiteralFunctionArgContextualTyping2.ts(12,6): error TS2322: Type '(s: string) => string' is not assignable to type '() => string'. + Target signature provides too few arguments. Expected 1 or more, but got 0. tests/cases/compiler/objectLiteralFunctionArgContextualTyping2.ts(13,17): error TS2322: Type '(s: any) => any' is not assignable to type '() => string'. + Target signature provides too few arguments. Expected 1 or more, but got 0. ==== tests/cases/compiler/objectLiteralFunctionArgContextualTyping2.ts (6 errors) ==== @@ -33,9 +36,12 @@ tests/cases/compiler/objectLiteralFunctionArgContextualTyping2.ts(13,17): error f2({ toString: (s) => s }) ~~~~~~~~ !!! error TS2322: Type '(s: any) => any' is not assignable to type '() => string'. +!!! error TS2322: Target signature provides too few arguments. Expected 1 or more, but got 0. f2({ toString: (s: string) => s }) ~~~~~~~~ !!! error TS2322: Type '(s: string) => string' is not assignable to type '() => string'. +!!! error TS2322: Target signature provides too few arguments. Expected 1 or more, but got 0. f2({ value: '', toString: (s) => s.uhhh }) ~~~~~~~~ -!!! error TS2322: Type '(s: any) => any' is not assignable to type '() => string'. \ No newline at end of file +!!! error TS2322: Type '(s: any) => any' is not assignable to type '() => string'. +!!! error TS2322: Target signature provides too few arguments. Expected 1 or more, but got 0. \ No newline at end of file diff --git a/tests/baselines/reference/parseTypes.errors.txt b/tests/baselines/reference/parseTypes.errors.txt index 8548cedc373..9fbd9334da1 100644 --- a/tests/baselines/reference/parseTypes.errors.txt +++ b/tests/baselines/reference/parseTypes.errors.txt @@ -1,5 +1,7 @@ tests/cases/compiler/parseTypes.ts(8,1): error TS2322: Type '(s: string) => void' is not assignable to type '() => number'. + Target signature provides too few arguments. Expected 1 or more, but got 0. tests/cases/compiler/parseTypes.ts(9,1): error TS2322: Type '(s: string) => void' is not assignable to type '() => number'. + Target signature provides too few arguments. Expected 1 or more, but got 0. tests/cases/compiler/parseTypes.ts(10,1): error TS2322: Type '(s: string) => void' is not assignable to type '{ [x: number]: number; }'. Index signature for type 'number' is missing in type '(s: string) => void'. tests/cases/compiler/parseTypes.ts(11,1): error TS2322: Type '(s: string) => void' is not assignable to type 'new () => number'. @@ -17,9 +19,11 @@ tests/cases/compiler/parseTypes.ts(11,1): error TS2322: Type '(s: string) => voi y=g; ~ !!! error TS2322: Type '(s: string) => void' is not assignable to type '() => number'. +!!! error TS2322: Target signature provides too few arguments. Expected 1 or more, but got 0. x=g; ~ !!! error TS2322: Type '(s: string) => void' is not assignable to type '() => number'. +!!! error TS2322: Target signature provides too few arguments. Expected 1 or more, but got 0. w=g; ~ !!! error TS2322: Type '(s: string) => void' is not assignable to type '{ [x: number]: number; }'. diff --git a/tests/baselines/reference/partiallyAnnotatedFunctionInferenceError.errors.txt b/tests/baselines/reference/partiallyAnnotatedFunctionInferenceError.errors.txt index a6a45245929..2f970037eab 100644 --- a/tests/baselines/reference/partiallyAnnotatedFunctionInferenceError.errors.txt +++ b/tests/baselines/reference/partiallyAnnotatedFunctionInferenceError.errors.txt @@ -1,6 +1,9 @@ tests/cases/conformance/types/contextualTypes/partiallyAnnotatedFunction/partiallyAnnotatedFunctionInferenceError.ts(12,11): error TS2345: Argument of type '(t1: D, t2: any, t3: any) => void' is not assignable to parameter of type '(t: any, t1: any) => void'. + Target signature provides too few arguments. Expected 3 or more, but got 2. tests/cases/conformance/types/contextualTypes/partiallyAnnotatedFunction/partiallyAnnotatedFunctionInferenceError.ts(13,11): error TS2345: Argument of type '(t1: any, t2: D, t3: any) => void' is not assignable to parameter of type '(t: any, t1: any) => void'. + Target signature provides too few arguments. Expected 3 or more, but got 2. tests/cases/conformance/types/contextualTypes/partiallyAnnotatedFunction/partiallyAnnotatedFunctionInferenceError.ts(14,11): error TS2345: Argument of type '(t1: any, t2: any, t3: D) => void' is not assignable to parameter of type '(t: any, t1: any) => void'. + Target signature provides too few arguments. Expected 3 or more, but got 2. ==== tests/cases/conformance/types/contextualTypes/partiallyAnnotatedFunction/partiallyAnnotatedFunctionInferenceError.ts (3 errors) ==== @@ -18,10 +21,13 @@ tests/cases/conformance/types/contextualTypes/partiallyAnnotatedFunction/partial testError((t1: D, t2, t3) => {}) ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(t1: D, t2: any, t3: any) => void' is not assignable to parameter of type '(t: any, t1: any) => void'. +!!! error TS2345: Target signature provides too few arguments. Expected 3 or more, but got 2. testError((t1, t2: D, t3) => {}) ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(t1: any, t2: D, t3: any) => void' is not assignable to parameter of type '(t: any, t1: any) => void'. +!!! error TS2345: Target signature provides too few arguments. Expected 3 or more, but got 2. testError((t1, t2, t3: D) => {}) ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(t1: any, t2: any, t3: D) => void' is not assignable to parameter of type '(t: any, t1: any) => void'. +!!! error TS2345: Target signature provides too few arguments. Expected 3 or more, but got 2. \ No newline at end of file diff --git a/tests/baselines/reference/promisePermutations.errors.txt b/tests/baselines/reference/promisePermutations.errors.txt index 766c92653f6..5e05243f8bf 100644 --- a/tests/baselines/reference/promisePermutations.errors.txt +++ b/tests/baselines/reference/promisePermutations.errors.txt @@ -26,27 +26,35 @@ tests/cases/compiler/promisePermutations.ts(84,19): error TS2769: No overload ma tests/cases/compiler/promisePermutations.ts(88,19): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations.ts(91,19): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations.ts(92,19): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: number, cb: (a: string) => string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations.ts(93,19): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: number, cb: (a: string) => string) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations.ts(97,19): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: number, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations.ts(100,19): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: number, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations.ts(101,19): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: number, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => Promise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations.ts(102,19): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: number, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations.ts(106,19): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. @@ -68,18 +76,23 @@ tests/cases/compiler/promisePermutations.ts(111,19): error TS2769: No overload m tests/cases/compiler/promisePermutations.ts(117,19): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations.ts(120,19): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations.ts(121,19): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: T, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: number) => Promise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations.ts(122,19): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: T, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: number) => IPromise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations.ts(126,19): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: T, cb: (a: U) => U) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations.ts(129,33): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. @@ -88,12 +101,15 @@ tests/cases/compiler/promisePermutations.ts(129,33): error TS2769: No overload m tests/cases/compiler/promisePermutations.ts(132,19): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: T, cb: (a: U) => U) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations.ts(133,19): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: T, cb: (a: U) => U) => Promise' is not assignable to parameter of type '(value: number) => Promise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations.ts(134,19): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: T, cb: (a: U) => U) => Promise' is not assignable to parameter of type '(value: number) => IPromise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations.ts(137,33): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. @@ -258,6 +274,7 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2769: No overload m !!! error TS2769: No overload matches this call. !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2769: Target signature provides too few arguments. Expected 2 or more, but got 1. !!! related TS2771 tests/cases/compiler/promisePermutations.ts:13:5: The last overload is declared here. var r5b = r5.then(sIPromise, sIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var s5: Promise; @@ -266,18 +283,21 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2769: No overload m !!! error TS2769: No overload matches this call. !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2769: Target signature provides too few arguments. Expected 2 or more, but got 1. !!! related TS2771 tests/cases/compiler/promisePermutations.ts:5:5: The last overload is declared here. var s5b = s5.then(testFunction5P, testFunction5P, testFunction5P); // error ~~~~~~~~~~~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(x: number, cb: (a: string) => string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. +!!! error TS2769: Target signature provides too few arguments. Expected 2 or more, but got 1. !!! related TS2771 tests/cases/compiler/promisePermutations.ts:5:5: The last overload is declared here. var s5c = s5.then(testFunction5P, testFunction5, testFunction5); // error ~~~~~~~~~~~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(x: number, cb: (a: string) => string) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2769: Target signature provides too few arguments. Expected 2 or more, but got 1. !!! related TS2771 tests/cases/compiler/promisePermutations.ts:5:5: The last overload is declared here. var s5d = s5.then(sPromise, sPromise, sPromise).then(sIPromise, sIPromise, sIPromise); // ok @@ -287,6 +307,7 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2769: No overload m !!! error TS2769: No overload matches this call. !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(x: number, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2769: Target signature provides too few arguments. Expected 2 or more, but got 1. !!! related TS2771 tests/cases/compiler/promisePermutations.ts:13:5: The last overload is declared here. var r6b = r6.then(sIPromise, sIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var s6: Promise; @@ -295,18 +316,21 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2769: No overload m !!! error TS2769: No overload matches this call. !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(x: number, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2769: Target signature provides too few arguments. Expected 2 or more, but got 1. !!! related TS2771 tests/cases/compiler/promisePermutations.ts:5:5: The last overload is declared here. var s6b = s6.then(testFunction6P, testFunction6P, testFunction6P); // error ~~~~~~~~~~~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(x: number, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => Promise'. +!!! error TS2769: Target signature provides too few arguments. Expected 2 or more, but got 1. !!! related TS2771 tests/cases/compiler/promisePermutations.ts:5:5: The last overload is declared here. var s6c = s6.then(testFunction6P, testFunction6, testFunction6); // error ~~~~~~~~~~~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(x: number, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2769: Target signature provides too few arguments. Expected 2 or more, but got 1. !!! related TS2771 tests/cases/compiler/promisePermutations.ts:5:5: The last overload is declared here. var s6d = s6.then(sPromise, sPromise, sPromise).then(sIPromise, sIPromise, sIPromise); // ok @@ -353,6 +377,7 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2769: No overload m !!! error TS2769: No overload matches this call. !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! error TS2769: Target signature provides too few arguments. Expected 2 or more, but got 1. !!! related TS2771 tests/cases/compiler/promisePermutations.ts:13:5: The last overload is declared here. var r8b = r8.then(nIPromise, nIPromise, nIPromise).then(nIPromise, nIPromise, nIPromise); // ok var s8: Promise; @@ -361,18 +386,21 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2769: No overload m !!! error TS2769: No overload matches this call. !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! error TS2769: Target signature provides too few arguments. Expected 2 or more, but got 1. !!! related TS2771 tests/cases/compiler/promisePermutations.ts:5:5: The last overload is declared here. var s8b = s8.then(testFunction8P, testFunction8P, testFunction8P); // error ~~~~~~~~~~~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(x: T, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: number) => Promise'. +!!! error TS2769: Target signature provides too few arguments. Expected 2 or more, but got 1. !!! related TS2771 tests/cases/compiler/promisePermutations.ts:5:5: The last overload is declared here. var s8c = s8.then(testFunction8P, testFunction8, testFunction8); // error ~~~~~~~~~~~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(x: T, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! error TS2769: Target signature provides too few arguments. Expected 2 or more, but got 1. !!! related TS2771 tests/cases/compiler/promisePermutations.ts:5:5: The last overload is declared here. var s8d = s8.then(nIPromise, nIPromise, nIPromise).then(nIPromise, nIPromise, nIPromise); // ok @@ -382,6 +410,7 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2769: No overload m !!! error TS2769: No overload matches this call. !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(x: T, cb: (a: U) => U) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! error TS2769: Target signature provides too few arguments. Expected 2 or more, but got 1. !!! related TS2771 tests/cases/compiler/promisePermutations.ts:13:5: The last overload is declared here. var r9b = r9.then(sIPromise, sIPromise, sIPromise); // ok var r9c = r9.then(nIPromise, nIPromise, nIPromise); // ok @@ -400,18 +429,21 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2769: No overload m !!! error TS2769: No overload matches this call. !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(x: T, cb: (a: U) => U) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! error TS2769: Target signature provides too few arguments. Expected 2 or more, but got 1. !!! related TS2771 tests/cases/compiler/promisePermutations.ts:5:5: The last overload is declared here. var s9b = s9.then(testFunction9P, testFunction9P, testFunction9P); // error ~~~~~~~~~~~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(x: T, cb: (a: U) => U) => Promise' is not assignable to parameter of type '(value: number) => Promise'. +!!! error TS2769: Target signature provides too few arguments. Expected 2 or more, but got 1. !!! related TS2771 tests/cases/compiler/promisePermutations.ts:5:5: The last overload is declared here. var s9c = s9.then(testFunction9P, testFunction9, testFunction9); // error ~~~~~~~~~~~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(x: T, cb: (a: U) => U) => Promise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! error TS2769: Target signature provides too few arguments. Expected 2 or more, but got 1. !!! related TS2771 tests/cases/compiler/promisePermutations.ts:5:5: The last overload is declared here. var s9d = s9.then(sPromise, sPromise, sPromise); // ok var s9e = s9.then(nPromise, nPromise, nPromise); // ok diff --git a/tests/baselines/reference/promisePermutations2.errors.txt b/tests/baselines/reference/promisePermutations2.errors.txt index 4c202914eea..fb5ac870ab1 100644 --- a/tests/baselines/reference/promisePermutations2.errors.txt +++ b/tests/baselines/reference/promisePermutations2.errors.txt @@ -18,15 +18,23 @@ tests/cases/compiler/promisePermutations2.ts(83,19): error TS2345: Argument of t tests/cases/compiler/promisePermutations2.ts(87,19): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations2.ts(90,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations2.ts(91,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations2.ts(92,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations2.ts(96,19): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: number, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations2.ts(99,19): error TS2345: Argument of type '(x: number, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations2.ts(100,19): error TS2345: Argument of type '(x: number, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => Promise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations2.ts(101,19): error TS2345: Argument of type '(x: number, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations2.ts(105,19): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. @@ -48,20 +56,28 @@ tests/cases/compiler/promisePermutations2.ts(110,19): error TS2769: No overload tests/cases/compiler/promisePermutations2.ts(116,19): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations2.ts(119,19): error TS2345: Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations2.ts(120,19): error TS2345: Argument of type '(x: T, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: number) => Promise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations2.ts(121,19): error TS2345: Argument of type '(x: T, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: number) => IPromise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations2.ts(125,19): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: T, cb: (a: U) => U) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations2.ts(128,33): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. Type 'IPromise' is not assignable to type 'IPromise'. Type 'string' is not assignable to type 'number'. tests/cases/compiler/promisePermutations2.ts(131,19): error TS2345: Argument of type '(x: T, cb: (a: U) => U) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations2.ts(132,19): error TS2345: Argument of type '(x: T, cb: (a: U) => U) => Promise' is not assignable to parameter of type '(value: number) => Promise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations2.ts(133,19): error TS2345: Argument of type '(x: T, cb: (a: U) => U) => Promise' is not assignable to parameter of type '(value: number) => IPromise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations2.ts(136,33): error TS2345: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. Type 'IPromise' is not assignable to type 'IPromise'. tests/cases/compiler/promisePermutations2.ts(143,35): error TS2769: No overload matches this call. @@ -203,18 +219,22 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of !!! error TS2769: No overload matches this call. !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2769: Target signature provides too few arguments. Expected 2 or more, but got 1. !!! related TS2771 tests/cases/compiler/promisePermutations2.ts:12:5: The last overload is declared here. var r5b = r5.then(sIPromise, sIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var s5: Promise; var s5a = s5.then(testFunction5, testFunction5, testFunction5); // error ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2345: Target signature provides too few arguments. Expected 2 or more, but got 1. var s5b = s5.then(testFunction5P, testFunction5P, testFunction5P); // error ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number, cb: (a: string) => string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. +!!! error TS2345: Target signature provides too few arguments. Expected 2 or more, but got 1. var s5c = s5.then(testFunction5P, testFunction5, testFunction5); // error ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number, cb: (a: string) => string) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2345: Target signature provides too few arguments. Expected 2 or more, but got 1. var s5d = s5.then(sPromise, sPromise, sPromise).then(sIPromise, sIPromise, sIPromise); // ok var r6: IPromise; @@ -223,18 +243,22 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of !!! error TS2769: No overload matches this call. !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(x: number, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2769: Target signature provides too few arguments. Expected 2 or more, but got 1. !!! related TS2771 tests/cases/compiler/promisePermutations2.ts:12:5: The last overload is declared here. var r6b = r6.then(sIPromise, sIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var s6: Promise; var s6a = s6.then(testFunction6, testFunction6, testFunction6); // error ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2345: Target signature provides too few arguments. Expected 2 or more, but got 1. var s6b = s6.then(testFunction6P, testFunction6P, testFunction6P); // error ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => Promise'. +!!! error TS2345: Target signature provides too few arguments. Expected 2 or more, but got 1. var s6c = s6.then(testFunction6P, testFunction6, testFunction6); // error ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2345: Target signature provides too few arguments. Expected 2 or more, but got 1. var s6d = s6.then(sPromise, sPromise, sPromise).then(sIPromise, sIPromise, sIPromise); // ok var r7: IPromise; @@ -280,18 +304,22 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of !!! error TS2769: No overload matches this call. !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! error TS2769: Target signature provides too few arguments. Expected 2 or more, but got 1. !!! related TS2771 tests/cases/compiler/promisePermutations2.ts:12:5: The last overload is declared here. var r8b = r8.then(nIPromise, nIPromise, nIPromise).then(nIPromise, nIPromise, nIPromise); // ok var s8: Promise; var s8a = s8.then(testFunction8, testFunction8, testFunction8); // error ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! error TS2345: Target signature provides too few arguments. Expected 2 or more, but got 1. var s8b = s8.then(testFunction8P, testFunction8P, testFunction8P); // error ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: T, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: number) => Promise'. +!!! error TS2345: Target signature provides too few arguments. Expected 2 or more, but got 1. var s8c = s8.then(testFunction8P, testFunction8, testFunction8); // error ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: T, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! error TS2345: Target signature provides too few arguments. Expected 2 or more, but got 1. var s8d = s8.then(nIPromise, nIPromise, nIPromise).then(nIPromise, nIPromise, nIPromise); // ok var r9: IPromise; @@ -300,6 +328,7 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of !!! error TS2769: No overload matches this call. !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(x: T, cb: (a: U) => U) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! error TS2769: Target signature provides too few arguments. Expected 2 or more, but got 1. !!! related TS2771 tests/cases/compiler/promisePermutations2.ts:12:5: The last overload is declared here. var r9b = r9.then(sIPromise, sIPromise, sIPromise); // ok var r9c = r9.then(nIPromise, nIPromise, nIPromise); // ok @@ -316,12 +345,15 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of var s9a = s9.then(testFunction9, testFunction9, testFunction9); // error ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: T, cb: (a: U) => U) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! error TS2345: Target signature provides too few arguments. Expected 2 or more, but got 1. var s9b = s9.then(testFunction9P, testFunction9P, testFunction9P); // error ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: T, cb: (a: U) => U) => Promise' is not assignable to parameter of type '(value: number) => Promise'. +!!! error TS2345: Target signature provides too few arguments. Expected 2 or more, but got 1. var s9c = s9.then(testFunction9P, testFunction9, testFunction9); // error ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: T, cb: (a: U) => U) => Promise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! error TS2345: Target signature provides too few arguments. Expected 2 or more, but got 1. var s9d = s9.then(sPromise, sPromise, sPromise); // ok var s9e = s9.then(nPromise, nPromise, nPromise); // ok var s9f = s9.then(testFunction, sIPromise, nIPromise); // error diff --git a/tests/baselines/reference/promisePermutations3.errors.txt b/tests/baselines/reference/promisePermutations3.errors.txt index a2de90f2d05..ed5fc6577ee 100644 --- a/tests/baselines/reference/promisePermutations3.errors.txt +++ b/tests/baselines/reference/promisePermutations3.errors.txt @@ -25,25 +25,33 @@ tests/cases/compiler/promisePermutations3.ts(83,19): error TS2769: No overload m Types of parameters 'x' and 'value' are incompatible. Type 'string' is not assignable to type 'number'. tests/cases/compiler/promisePermutations3.ts(87,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations3.ts(90,19): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations3.ts(91,19): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: number, cb: (a: string) => string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations3.ts(92,19): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: number, cb: (a: string) => string) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations3.ts(96,19): error TS2345: Argument of type '(x: number, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations3.ts(99,19): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: number, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations3.ts(100,19): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: number, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => Promise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations3.ts(101,19): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: number, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations3.ts(105,19): error TS2345: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'cb' and 'value' are incompatible. Type 'string' is not assignable to type '(a: T) => T'. @@ -55,28 +63,36 @@ tests/cases/compiler/promisePermutations3.ts(110,19): error TS2345: Argument of Types of parameters 'cb' and 'value' are incompatible. Type 'string' is not assignable to type '(a: T) => T'. tests/cases/compiler/promisePermutations3.ts(116,19): error TS2345: Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations3.ts(119,19): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations3.ts(120,19): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: T, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: number) => Promise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations3.ts(121,19): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: T, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: number) => IPromise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations3.ts(125,19): error TS2345: Argument of type '(x: T, cb: (a: U) => U) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations3.ts(128,33): error TS2345: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. Type 'IPromise' is not assignable to type 'IPromise'. Type 'string' is not assignable to type 'number'. tests/cases/compiler/promisePermutations3.ts(131,19): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: T, cb: (a: U) => U) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations3.ts(132,19): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: T, cb: (a: U) => U) => Promise' is not assignable to parameter of type '(value: number) => Promise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations3.ts(133,19): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: T, cb: (a: U) => U) => Promise' is not assignable to parameter of type '(value: number) => IPromise'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/compiler/promisePermutations3.ts(136,33): error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => IPromise'. @@ -237,6 +253,7 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of var r5a = r5.then(testFunction5, testFunction5, testFunction5); // error ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2345: Target signature provides too few arguments. Expected 2 or more, but got 1. var r5b = r5.then(sIPromise, sIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var s5: Promise; var s5a = s5.then(testFunction5, testFunction5, testFunction5); // error @@ -244,18 +261,21 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of !!! error TS2769: No overload matches this call. !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2769: Target signature provides too few arguments. Expected 2 or more, but got 1. !!! related TS2771 tests/cases/compiler/promisePermutations3.ts:7:5: The last overload is declared here. var s5b = s5.then(testFunction5P, testFunction5P, testFunction5P); // error ~~~~~~~~~~~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(x: number, cb: (a: string) => string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. +!!! error TS2769: Target signature provides too few arguments. Expected 2 or more, but got 1. !!! related TS2771 tests/cases/compiler/promisePermutations3.ts:7:5: The last overload is declared here. var s5c = s5.then(testFunction5P, testFunction5, testFunction5); // error ~~~~~~~~~~~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(x: number, cb: (a: string) => string) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2769: Target signature provides too few arguments. Expected 2 or more, but got 1. !!! related TS2771 tests/cases/compiler/promisePermutations3.ts:7:5: The last overload is declared here. var s5d = s5.then(sPromise, sPromise, sPromise).then(sIPromise, sIPromise, sIPromise); // ok @@ -263,6 +283,7 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of var r6a = r6.then(testFunction6, testFunction6, testFunction6); // error ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2345: Target signature provides too few arguments. Expected 2 or more, but got 1. var r6b = r6.then(sIPromise, sIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var s6: Promise; var s6a = s6.then(testFunction6, testFunction6, testFunction6); // error @@ -270,18 +291,21 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of !!! error TS2769: No overload matches this call. !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(x: number, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2769: Target signature provides too few arguments. Expected 2 or more, but got 1. !!! related TS2771 tests/cases/compiler/promisePermutations3.ts:7:5: The last overload is declared here. var s6b = s6.then(testFunction6P, testFunction6P, testFunction6P); // error ~~~~~~~~~~~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(x: number, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => Promise'. +!!! error TS2769: Target signature provides too few arguments. Expected 2 or more, but got 1. !!! related TS2771 tests/cases/compiler/promisePermutations3.ts:7:5: The last overload is declared here. var s6c = s6.then(testFunction6P, testFunction6, testFunction6); // error ~~~~~~~~~~~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(x: number, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. +!!! error TS2769: Target signature provides too few arguments. Expected 2 or more, but got 1. !!! related TS2771 tests/cases/compiler/promisePermutations3.ts:7:5: The last overload is declared here. var s6d = s6.then(sPromise, sPromise, sPromise).then(sIPromise, sIPromise, sIPromise); // ok @@ -314,6 +338,7 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of var r8a = r8.then(testFunction8, testFunction8, testFunction8); // error ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! error TS2345: Target signature provides too few arguments. Expected 2 or more, but got 1. var r8b = r8.then(nIPromise, nIPromise, nIPromise).then(nIPromise, nIPromise, nIPromise); // ok var s8: Promise; var s8a = s8.then(testFunction8, testFunction8, testFunction8); // error @@ -321,18 +346,21 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of !!! error TS2769: No overload matches this call. !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! error TS2769: Target signature provides too few arguments. Expected 2 or more, but got 1. !!! related TS2771 tests/cases/compiler/promisePermutations3.ts:7:5: The last overload is declared here. var s8b = s8.then(testFunction8P, testFunction8P, testFunction8P); // error ~~~~~~~~~~~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(x: T, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: number) => Promise'. +!!! error TS2769: Target signature provides too few arguments. Expected 2 or more, but got 1. !!! related TS2771 tests/cases/compiler/promisePermutations3.ts:7:5: The last overload is declared here. var s8c = s8.then(testFunction8P, testFunction8, testFunction8); // error ~~~~~~~~~~~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(x: T, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! error TS2769: Target signature provides too few arguments. Expected 2 or more, but got 1. !!! related TS2771 tests/cases/compiler/promisePermutations3.ts:7:5: The last overload is declared here. var s8d = s8.then(nIPromise, nIPromise, nIPromise).then(nIPromise, nIPromise, nIPromise); // ok @@ -340,6 +368,7 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of var r9a = r9.then(testFunction9, testFunction9, testFunction9); // error ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: T, cb: (a: U) => U) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! error TS2345: Target signature provides too few arguments. Expected 2 or more, but got 1. var r9b = r9.then(sIPromise, sIPromise, sIPromise); // ok var r9c = r9.then(nIPromise, nIPromise, nIPromise); // ok var r9d = r9.then(testFunction, sIPromise, nIPromise); // error @@ -354,18 +383,21 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of !!! error TS2769: No overload matches this call. !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(x: T, cb: (a: U) => U) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! error TS2769: Target signature provides too few arguments. Expected 2 or more, but got 1. !!! related TS2771 tests/cases/compiler/promisePermutations3.ts:7:5: The last overload is declared here. var s9b = s9.then(testFunction9P, testFunction9P, testFunction9P); // error ~~~~~~~~~~~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(x: T, cb: (a: U) => U) => Promise' is not assignable to parameter of type '(value: number) => Promise'. +!!! error TS2769: Target signature provides too few arguments. Expected 2 or more, but got 1. !!! related TS2771 tests/cases/compiler/promisePermutations3.ts:7:5: The last overload is declared here. var s9c = s9.then(testFunction9P, testFunction9, testFunction9); // error ~~~~~~~~~~~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: The last overload gave the following error. !!! error TS2769: Argument of type '(x: T, cb: (a: U) => U) => Promise' is not assignable to parameter of type '(value: number) => IPromise'. +!!! error TS2769: Target signature provides too few arguments. Expected 2 or more, but got 1. !!! related TS2771 tests/cases/compiler/promisePermutations3.ts:7:5: The last overload is declared here. var s9d = s9.then(sPromise, sPromise, sPromise); // ok var s9e = s9.then(nPromise, nPromise, nPromise); // ok diff --git a/tests/baselines/reference/requiredInitializedParameter2.errors.txt b/tests/baselines/reference/requiredInitializedParameter2.errors.txt index 278d5c0f359..1e786a8eb76 100644 --- a/tests/baselines/reference/requiredInitializedParameter2.errors.txt +++ b/tests/baselines/reference/requiredInitializedParameter2.errors.txt @@ -1,5 +1,6 @@ tests/cases/compiler/requiredInitializedParameter2.ts(6,5): error TS2416: Property 'method' in type 'C1' is not assignable to the same property in base type 'I1'. Type '(a: number, b: any) => void' is not assignable to type '() => any'. + Target signature provides too few arguments. Expected 2 or more, but got 0. ==== tests/cases/compiler/requiredInitializedParameter2.ts (1 errors) ==== @@ -12,4 +13,5 @@ tests/cases/compiler/requiredInitializedParameter2.ts(6,5): error TS2416: Proper ~~~~~~ !!! error TS2416: Property 'method' in type 'C1' is not assignable to the same property in base type 'I1'. !!! error TS2416: Type '(a: number, b: any) => void' is not assignable to type '() => any'. +!!! error TS2416: Target signature provides too few arguments. Expected 2 or more, but got 0. } \ No newline at end of file diff --git a/tests/baselines/reference/reverseMappedTypeContextualTypeNotCircular.errors.txt b/tests/baselines/reference/reverseMappedTypeContextualTypeNotCircular.errors.txt index d5462d0d0b7..ef1df41caec 100644 --- a/tests/baselines/reference/reverseMappedTypeContextualTypeNotCircular.errors.txt +++ b/tests/baselines/reference/reverseMappedTypeContextualTypeNotCircular.errors.txt @@ -1,4 +1,5 @@ tests/cases/compiler/reverseMappedTypeContextualTypeNotCircular.ts(10,3): error TS2322: Type '(state: any, props: any) => {}' is not assignable to type 'Selector'. + Target signature provides too few arguments. Expected 2 or more, but got 1. ==== tests/cases/compiler/reverseMappedTypeContextualTypeNotCircular.ts (1 errors) ==== @@ -14,5 +15,6 @@ tests/cases/compiler/reverseMappedTypeContextualTypeNotCircular.ts(10,3): error editable: (state: any, props: any) => editable(), // expect "Type '(state: any, props: any) => {}' is not assignable to type 'Selector'", _not_ a circularity error ~~~~~~~~ !!! error TS2322: Type '(state: any, props: any) => {}' is not assignable to type 'Selector'. +!!! error TS2322: Target signature provides too few arguments. Expected 2 or more, but got 1. !!! related TS6500 tests/cases/compiler/reverseMappedTypeContextualTypeNotCircular.ts:10:3: The expected type comes from property 'editable' which is declared here on type '{ editable: Selector; }' }); \ No newline at end of file diff --git a/tests/baselines/reference/signatureLengthMismatchCall.errors.txt b/tests/baselines/reference/signatureLengthMismatchCall.errors.txt new file mode 100644 index 00000000000..86d0fb96889 --- /dev/null +++ b/tests/baselines/reference/signatureLengthMismatchCall.errors.txt @@ -0,0 +1,14 @@ +tests/cases/compiler/signatureLengthMismatchCall.ts(5,15): error TS2345: Argument of type '(a: number, b: number) => void' is not assignable to parameter of type '(a: number) => void'. + Target signature provides too few arguments. Expected 2 or more, but got 1. + + +==== tests/cases/compiler/signatureLengthMismatchCall.ts (1 errors) ==== + function takesCallback(fn: (a: number) => void) { + // ... + } + + takesCallback((a: number, b: number) => {}); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '(a: number, b: number) => void' is not assignable to parameter of type '(a: number) => void'. +!!! error TS2345: Target signature provides too few arguments. Expected 2 or more, but got 1. + \ No newline at end of file diff --git a/tests/baselines/reference/signatureLengthMismatchCall.js b/tests/baselines/reference/signatureLengthMismatchCall.js new file mode 100644 index 00000000000..5d6e3db9cd0 --- /dev/null +++ b/tests/baselines/reference/signatureLengthMismatchCall.js @@ -0,0 +1,13 @@ +//// [signatureLengthMismatchCall.ts] +function takesCallback(fn: (a: number) => void) { + // ... +} + +takesCallback((a: number, b: number) => {}); + + +//// [signatureLengthMismatchCall.js] +function takesCallback(fn) { + // ... +} +takesCallback(function (a, b) { }); diff --git a/tests/baselines/reference/signatureLengthMismatchCall.symbols b/tests/baselines/reference/signatureLengthMismatchCall.symbols new file mode 100644 index 00000000000..2dea6b1f487 --- /dev/null +++ b/tests/baselines/reference/signatureLengthMismatchCall.symbols @@ -0,0 +1,14 @@ +=== tests/cases/compiler/signatureLengthMismatchCall.ts === +function takesCallback(fn: (a: number) => void) { +>takesCallback : Symbol(takesCallback, Decl(signatureLengthMismatchCall.ts, 0, 0)) +>fn : Symbol(fn, Decl(signatureLengthMismatchCall.ts, 0, 23)) +>a : Symbol(a, Decl(signatureLengthMismatchCall.ts, 0, 28)) + + // ... +} + +takesCallback((a: number, b: number) => {}); +>takesCallback : Symbol(takesCallback, Decl(signatureLengthMismatchCall.ts, 0, 0)) +>a : Symbol(a, Decl(signatureLengthMismatchCall.ts, 4, 15)) +>b : Symbol(b, Decl(signatureLengthMismatchCall.ts, 4, 25)) + diff --git a/tests/baselines/reference/signatureLengthMismatchCall.types b/tests/baselines/reference/signatureLengthMismatchCall.types new file mode 100644 index 00000000000..40adf7ef828 --- /dev/null +++ b/tests/baselines/reference/signatureLengthMismatchCall.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/signatureLengthMismatchCall.ts === +function takesCallback(fn: (a: number) => void) { +>takesCallback : (fn: (a: number) => void) => void +>fn : (a: number) => void +>a : number + + // ... +} + +takesCallback((a: number, b: number) => {}); +>takesCallback((a: number, b: number) => {}) : void +>takesCallback : (fn: (a: number) => void) => void +>(a: number, b: number) => {} : (a: number, b: number) => void +>a : number +>b : number + diff --git a/tests/baselines/reference/signatureLengthMismatchInOverload.errors.txt b/tests/baselines/reference/signatureLengthMismatchInOverload.errors.txt new file mode 100644 index 00000000000..cc315cb156f --- /dev/null +++ b/tests/baselines/reference/signatureLengthMismatchInOverload.errors.txt @@ -0,0 +1,27 @@ +tests/cases/compiler/signatureLengthMismatchInOverload.ts(5,3): error TS2769: No overload matches this call. + Overload 1 of 2, '(callback: (arg: string, arg2: string) => void): void', gave the following error. + Argument of type '(arg: number, arg2: number) => void' is not assignable to parameter of type '(arg: string, arg2: string) => void'. + Types of parameters 'arg' and 'arg' are incompatible. + Type 'string' is not assignable to type 'number'. + Overload 2 of 2, '(callback: (arg: number) => void): void', gave the following error. + Argument of type '(arg: number, arg2: number) => void' is not assignable to parameter of type '(arg: number) => void'. + Target signature provides too few arguments. Expected 2 or more, but got 1. + + +==== tests/cases/compiler/signatureLengthMismatchInOverload.ts (1 errors) ==== + function f(callback: (arg: string, arg2: string) => void): void; + function f(callback: (arg: number) => void): void; + function f(callback: unknown) { } + + f((arg: number, arg2: number) => {}); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2769: No overload matches this call. +!!! error TS2769: Overload 1 of 2, '(callback: (arg: string, arg2: string) => void): void', gave the following error. +!!! error TS2769: Argument of type '(arg: number, arg2: number) => void' is not assignable to parameter of type '(arg: string, arg2: string) => void'. +!!! error TS2769: Types of parameters 'arg' and 'arg' are incompatible. +!!! error TS2769: Type 'string' is not assignable to type 'number'. +!!! error TS2769: Overload 2 of 2, '(callback: (arg: number) => void): void', gave the following error. +!!! error TS2769: Argument of type '(arg: number, arg2: number) => void' is not assignable to parameter of type '(arg: number) => void'. +!!! error TS2769: Target signature provides too few arguments. Expected 2 or more, but got 1. +!!! related TS2793 tests/cases/compiler/signatureLengthMismatchInOverload.ts:3:10: The call would have succeeded against this implementation, but implementation signatures of overloads are not externally visible. + \ No newline at end of file diff --git a/tests/baselines/reference/signatureLengthMismatchInOverload.js b/tests/baselines/reference/signatureLengthMismatchInOverload.js new file mode 100644 index 00000000000..ab074b66fb2 --- /dev/null +++ b/tests/baselines/reference/signatureLengthMismatchInOverload.js @@ -0,0 +1,11 @@ +//// [signatureLengthMismatchInOverload.ts] +function f(callback: (arg: string, arg2: string) => void): void; +function f(callback: (arg: number) => void): void; +function f(callback: unknown) { } + +f((arg: number, arg2: number) => {}); + + +//// [signatureLengthMismatchInOverload.js] +function f(callback) { } +f(function (arg, arg2) { }); diff --git a/tests/baselines/reference/signatureLengthMismatchInOverload.symbols b/tests/baselines/reference/signatureLengthMismatchInOverload.symbols new file mode 100644 index 00000000000..1b69b24450f --- /dev/null +++ b/tests/baselines/reference/signatureLengthMismatchInOverload.symbols @@ -0,0 +1,21 @@ +=== tests/cases/compiler/signatureLengthMismatchInOverload.ts === +function f(callback: (arg: string, arg2: string) => void): void; +>f : Symbol(f, Decl(signatureLengthMismatchInOverload.ts, 0, 0), Decl(signatureLengthMismatchInOverload.ts, 0, 64), Decl(signatureLengthMismatchInOverload.ts, 1, 50)) +>callback : Symbol(callback, Decl(signatureLengthMismatchInOverload.ts, 0, 11)) +>arg : Symbol(arg, Decl(signatureLengthMismatchInOverload.ts, 0, 22)) +>arg2 : Symbol(arg2, Decl(signatureLengthMismatchInOverload.ts, 0, 34)) + +function f(callback: (arg: number) => void): void; +>f : Symbol(f, Decl(signatureLengthMismatchInOverload.ts, 0, 0), Decl(signatureLengthMismatchInOverload.ts, 0, 64), Decl(signatureLengthMismatchInOverload.ts, 1, 50)) +>callback : Symbol(callback, Decl(signatureLengthMismatchInOverload.ts, 1, 11)) +>arg : Symbol(arg, Decl(signatureLengthMismatchInOverload.ts, 1, 22)) + +function f(callback: unknown) { } +>f : Symbol(f, Decl(signatureLengthMismatchInOverload.ts, 0, 0), Decl(signatureLengthMismatchInOverload.ts, 0, 64), Decl(signatureLengthMismatchInOverload.ts, 1, 50)) +>callback : Symbol(callback, Decl(signatureLengthMismatchInOverload.ts, 2, 11)) + +f((arg: number, arg2: number) => {}); +>f : Symbol(f, Decl(signatureLengthMismatchInOverload.ts, 0, 0), Decl(signatureLengthMismatchInOverload.ts, 0, 64), Decl(signatureLengthMismatchInOverload.ts, 1, 50)) +>arg : Symbol(arg, Decl(signatureLengthMismatchInOverload.ts, 4, 3)) +>arg2 : Symbol(arg2, Decl(signatureLengthMismatchInOverload.ts, 4, 15)) + diff --git a/tests/baselines/reference/signatureLengthMismatchInOverload.types b/tests/baselines/reference/signatureLengthMismatchInOverload.types new file mode 100644 index 00000000000..5d02681f328 --- /dev/null +++ b/tests/baselines/reference/signatureLengthMismatchInOverload.types @@ -0,0 +1,23 @@ +=== tests/cases/compiler/signatureLengthMismatchInOverload.ts === +function f(callback: (arg: string, arg2: string) => void): void; +>f : { (callback: (arg: string, arg2: string) => void): void; (callback: (arg: number) => void): void; } +>callback : (arg: string, arg2: string) => void +>arg : string +>arg2 : string + +function f(callback: (arg: number) => void): void; +>f : { (callback: (arg: string, arg2: string) => void): void; (callback: (arg: number) => void): void; } +>callback : (arg: number) => void +>arg : number + +function f(callback: unknown) { } +>f : { (callback: (arg: string, arg2: string) => void): void; (callback: (arg: number) => void): void; } +>callback : unknown + +f((arg: number, arg2: number) => {}); +>f((arg: number, arg2: number) => {}) : void +>f : { (callback: (arg: string, arg2: string) => void): void; (callback: (arg: number) => void): void; } +>(arg: number, arg2: number) => {} : (arg: number, arg2: number) => void +>arg : number +>arg2 : number + diff --git a/tests/baselines/reference/signatureLengthMismatchWithOptionalParameters.errors.txt b/tests/baselines/reference/signatureLengthMismatchWithOptionalParameters.errors.txt new file mode 100644 index 00000000000..b5a3db18695 --- /dev/null +++ b/tests/baselines/reference/signatureLengthMismatchWithOptionalParameters.errors.txt @@ -0,0 +1,14 @@ +tests/cases/compiler/signatureLengthMismatchWithOptionalParameters.ts(5,8): error TS2345: Argument of type '(n: number, m: string) => void' is not assignable to parameter of type '(n?: number) => void'. + Target signature provides too few arguments. Expected 2 or more, but got 1. + + +==== tests/cases/compiler/signatureLengthMismatchWithOptionalParameters.ts (1 errors) ==== + function callee(n: number | undefined, m: string) { } + + function caller(arg: (n?: number) => void) { } + + caller(callee); + ~~~~~~ +!!! error TS2345: Argument of type '(n: number, m: string) => void' is not assignable to parameter of type '(n?: number) => void'. +!!! error TS2345: Target signature provides too few arguments. Expected 2 or more, but got 1. + \ No newline at end of file diff --git a/tests/baselines/reference/signatureLengthMismatchWithOptionalParameters.js b/tests/baselines/reference/signatureLengthMismatchWithOptionalParameters.js new file mode 100644 index 00000000000..a23f65e2564 --- /dev/null +++ b/tests/baselines/reference/signatureLengthMismatchWithOptionalParameters.js @@ -0,0 +1,12 @@ +//// [signatureLengthMismatchWithOptionalParameters.ts] +function callee(n: number | undefined, m: string) { } + +function caller(arg: (n?: number) => void) { } + +caller(callee); + + +//// [signatureLengthMismatchWithOptionalParameters.js] +function callee(n, m) { } +function caller(arg) { } +caller(callee); diff --git a/tests/baselines/reference/signatureLengthMismatchWithOptionalParameters.symbols b/tests/baselines/reference/signatureLengthMismatchWithOptionalParameters.symbols new file mode 100644 index 00000000000..c26c1a7c171 --- /dev/null +++ b/tests/baselines/reference/signatureLengthMismatchWithOptionalParameters.symbols @@ -0,0 +1,15 @@ +=== tests/cases/compiler/signatureLengthMismatchWithOptionalParameters.ts === +function callee(n: number | undefined, m: string) { } +>callee : Symbol(callee, Decl(signatureLengthMismatchWithOptionalParameters.ts, 0, 0)) +>n : Symbol(n, Decl(signatureLengthMismatchWithOptionalParameters.ts, 0, 16)) +>m : Symbol(m, Decl(signatureLengthMismatchWithOptionalParameters.ts, 0, 38)) + +function caller(arg: (n?: number) => void) { } +>caller : Symbol(caller, Decl(signatureLengthMismatchWithOptionalParameters.ts, 0, 53)) +>arg : Symbol(arg, Decl(signatureLengthMismatchWithOptionalParameters.ts, 2, 16)) +>n : Symbol(n, Decl(signatureLengthMismatchWithOptionalParameters.ts, 2, 22)) + +caller(callee); +>caller : Symbol(caller, Decl(signatureLengthMismatchWithOptionalParameters.ts, 0, 53)) +>callee : Symbol(callee, Decl(signatureLengthMismatchWithOptionalParameters.ts, 0, 0)) + diff --git a/tests/baselines/reference/signatureLengthMismatchWithOptionalParameters.types b/tests/baselines/reference/signatureLengthMismatchWithOptionalParameters.types new file mode 100644 index 00000000000..47cbcc1cc4d --- /dev/null +++ b/tests/baselines/reference/signatureLengthMismatchWithOptionalParameters.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/signatureLengthMismatchWithOptionalParameters.ts === +function callee(n: number | undefined, m: string) { } +>callee : (n: number | undefined, m: string) => void +>n : number +>m : string + +function caller(arg: (n?: number) => void) { } +>caller : (arg: (n?: number) => void) => void +>arg : (n?: number) => void +>n : number + +caller(callee); +>caller(callee) : void +>caller : (arg: (n?: number) => void) => void +>callee : (n: number, m: string) => void + diff --git a/tests/baselines/reference/subtypingWithCallSignaturesWithOptionalParameters.errors.txt b/tests/baselines/reference/subtypingWithCallSignaturesWithOptionalParameters.errors.txt index b5d23da2241..9e123b37188 100644 --- a/tests/baselines/reference/subtypingWithCallSignaturesWithOptionalParameters.errors.txt +++ b/tests/baselines/reference/subtypingWithCallSignaturesWithOptionalParameters.errors.txt @@ -1,9 +1,11 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithOptionalParameters.ts(19,11): error TS2430: Interface 'I3' incorrectly extends interface 'Base'. Types of property 'a' are incompatible. Type '(x: number) => number' is not assignable to type '() => number'. + Target signature provides too few arguments. Expected 1 or more, but got 0. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithOptionalParameters.ts(49,11): error TS2430: Interface 'I10' incorrectly extends interface 'Base'. Types of property 'a3' are incompatible. Type '(x: number, y: number) => number' is not assignable to type '(x: number) => number'. + Target signature provides too few arguments. Expected 2 or more, but got 1. ==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithOptionalParameters.ts (2 errors) ==== @@ -30,6 +32,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Interface 'I3' incorrectly extends interface 'Base'. !!! error TS2430: Types of property 'a' are incompatible. !!! error TS2430: Type '(x: number) => number' is not assignable to type '() => number'. +!!! error TS2430: Target signature provides too few arguments. Expected 1 or more, but got 0. a: (x: number) => number; // error, too many required params } @@ -64,6 +67,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Interface 'I10' incorrectly extends interface 'Base'. !!! error TS2430: Types of property 'a3' are incompatible. !!! error TS2430: Type '(x: number, y: number) => number' is not assignable to type '(x: number) => number'. +!!! error TS2430: Target signature provides too few arguments. Expected 2 or more, but got 1. a3: (x: number, y: number) => number; // error, too many required params } diff --git a/tests/baselines/reference/subtypingWithConstructSignaturesWithOptionalParameters.errors.txt b/tests/baselines/reference/subtypingWithConstructSignaturesWithOptionalParameters.errors.txt index e041b1cdce0..2febb535b28 100644 --- a/tests/baselines/reference/subtypingWithConstructSignaturesWithOptionalParameters.errors.txt +++ b/tests/baselines/reference/subtypingWithConstructSignaturesWithOptionalParameters.errors.txt @@ -1,9 +1,11 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignaturesWithOptionalParameters.ts(19,11): error TS2430: Interface 'I3' incorrectly extends interface 'Base'. Types of property 'a' are incompatible. Type 'new (x: number) => number' is not assignable to type 'new () => number'. + Target signature provides too few arguments. Expected 1 or more, but got 0. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignaturesWithOptionalParameters.ts(49,11): error TS2430: Interface 'I10' incorrectly extends interface 'Base'. Types of property 'a3' are incompatible. Type 'new (x: number, y: number) => number' is not assignable to type 'new (x: number) => number'. + Target signature provides too few arguments. Expected 2 or more, but got 1. ==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignaturesWithOptionalParameters.ts (2 errors) ==== @@ -30,6 +32,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Interface 'I3' incorrectly extends interface 'Base'. !!! error TS2430: Types of property 'a' are incompatible. !!! error TS2430: Type 'new (x: number) => number' is not assignable to type 'new () => number'. +!!! error TS2430: Target signature provides too few arguments. Expected 1 or more, but got 0. a: new (x: number) => number; // error, too many required params } @@ -64,6 +67,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Interface 'I10' incorrectly extends interface 'Base'. !!! error TS2430: Types of property 'a3' are incompatible. !!! error TS2430: Type 'new (x: number, y: number) => number' is not assignable to type 'new (x: number) => number'. +!!! error TS2430: Target signature provides too few arguments. Expected 2 or more, but got 1. a3: new (x: number, y: number) => number; // error, too many required params } diff --git a/tests/baselines/reference/subtypingWithGenericCallSignaturesWithOptionalParameters.errors.txt b/tests/baselines/reference/subtypingWithGenericCallSignaturesWithOptionalParameters.errors.txt index b9d5dc7ae8b..27755bf2b7c 100644 --- a/tests/baselines/reference/subtypingWithGenericCallSignaturesWithOptionalParameters.errors.txt +++ b/tests/baselines/reference/subtypingWithGenericCallSignaturesWithOptionalParameters.errors.txt @@ -1,9 +1,11 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(20,15): error TS2430: Interface 'I3' incorrectly extends interface 'Base'. Types of property 'a' are incompatible. Type '(x: T) => T' is not assignable to type '() => T'. + Target signature provides too few arguments. Expected 1 or more, but got 0. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(50,15): error TS2430: Interface 'I10' incorrectly extends interface 'Base'. Types of property 'a3' are incompatible. Type '(x: T, y: T) => T' is not assignable to type '(x: T) => T'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(100,15): error TS2430: Interface 'I1' incorrectly extends interface 'Base2'. The types returned by 'a()' are incompatible between these types. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. @@ -15,6 +17,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(108,15): error TS2430: Interface 'I3' incorrectly extends interface 'Base2'. Types of property 'a' are incompatible. Type '(x: T) => T' is not assignable to type '() => T'. + Target signature provides too few arguments. Expected 1 or more, but got 0. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(113,15): error TS2430: Interface 'I4' incorrectly extends interface 'Base2'. The types returned by 'a2(...)' are incompatible between these types. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. @@ -50,6 +53,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(138,15): error TS2430: Interface 'I10' incorrectly extends interface 'Base2'. Types of property 'a3' are incompatible. Type '(x: T, y: T) => T' is not assignable to type '(x: T) => T'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(143,15): error TS2430: Interface 'I11' incorrectly extends interface 'Base2'. The types returned by 'a4(...)' are incompatible between these types. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. @@ -97,9 +101,11 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(196,15): error TS2430: Interface 'I3' incorrectly extends interface 'Base2'. Types of property 'a' are incompatible. Type '(x: T) => T' is not assignable to type '() => T'. + Target signature provides too few arguments. Expected 1 or more, but got 0. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(226,15): error TS2430: Interface 'I10' incorrectly extends interface 'Base2'. Types of property 'a3' are incompatible. Type '(x: T, y: T) => T' is not assignable to type '(x: T) => T'. + Target signature provides too few arguments. Expected 2 or more, but got 1. ==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts (22 errors) ==== @@ -127,6 +133,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Interface 'I3' incorrectly extends interface 'Base'. !!! error TS2430: Types of property 'a' are incompatible. !!! error TS2430: Type '(x: T) => T' is not assignable to type '() => T'. +!!! error TS2430: Target signature provides too few arguments. Expected 1 or more, but got 0. a: (x: T) => T; // error, too many required params } @@ -161,6 +168,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Interface 'I10' incorrectly extends interface 'Base'. !!! error TS2430: Types of property 'a3' are incompatible. !!! error TS2430: Type '(x: T, y: T) => T' is not assignable to type '(x: T) => T'. +!!! error TS2430: Target signature provides too few arguments. Expected 2 or more, but got 1. a3: (x: T, y: T) => T; // error, too many required params } @@ -235,6 +243,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Interface 'I3' incorrectly extends interface 'Base2'. !!! error TS2430: Types of property 'a' are incompatible. !!! error TS2430: Type '(x: T) => T' is not assignable to type '() => T'. +!!! error TS2430: Target signature provides too few arguments. Expected 1 or more, but got 0. a: (x: T) => T; } @@ -313,6 +322,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Interface 'I10' incorrectly extends interface 'Base2'. !!! error TS2430: Types of property 'a3' are incompatible. !!! error TS2430: Type '(x: T, y: T) => T' is not assignable to type '(x: T) => T'. +!!! error TS2430: Target signature provides too few arguments. Expected 2 or more, but got 1. a3: (x: T, y: T) => T; } @@ -435,6 +445,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Interface 'I3' incorrectly extends interface 'Base2'. !!! error TS2430: Types of property 'a' are incompatible. !!! error TS2430: Type '(x: T) => T' is not assignable to type '() => T'. +!!! error TS2430: Target signature provides too few arguments. Expected 1 or more, but got 0. a: (x: T) => T; // error, not identical and contextual signature instatiation can't make inference from T to T } @@ -469,6 +480,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Interface 'I10' incorrectly extends interface 'Base2'. !!! error TS2430: Types of property 'a3' are incompatible. !!! error TS2430: Type '(x: T, y: T) => T' is not assignable to type '(x: T) => T'. +!!! error TS2430: Target signature provides too few arguments. Expected 2 or more, but got 1. a3: (x: T, y: T) => T; // error, too many required params } diff --git a/tests/baselines/reference/subtypingWithGenericConstructSignaturesWithOptionalParameters.errors.txt b/tests/baselines/reference/subtypingWithGenericConstructSignaturesWithOptionalParameters.errors.txt index 3324928c05c..888919b8884 100644 --- a/tests/baselines/reference/subtypingWithGenericConstructSignaturesWithOptionalParameters.errors.txt +++ b/tests/baselines/reference/subtypingWithGenericConstructSignaturesWithOptionalParameters.errors.txt @@ -1,9 +1,11 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(20,15): error TS2430: Interface 'I3' incorrectly extends interface 'Base'. Types of property 'a' are incompatible. Type 'new (x: T) => T' is not assignable to type 'new () => T'. + Target signature provides too few arguments. Expected 1 or more, but got 0. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(50,15): error TS2430: Interface 'I10' incorrectly extends interface 'Base'. Types of property 'a3' are incompatible. Type 'new (x: T, y: T) => T' is not assignable to type 'new (x: T) => T'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(100,15): error TS2430: Interface 'I1' incorrectly extends interface 'Base2'. The types returned by 'new a()' are incompatible between these types. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. @@ -15,6 +17,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(108,15): error TS2430: Interface 'I3' incorrectly extends interface 'Base2'. Types of property 'a' are incompatible. Type 'new (x: T) => T' is not assignable to type 'new () => T'. + Target signature provides too few arguments. Expected 1 or more, but got 0. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(113,15): error TS2430: Interface 'I4' incorrectly extends interface 'Base2'. The types returned by 'new a2(...)' are incompatible between these types. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. @@ -50,6 +53,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(138,15): error TS2430: Interface 'I10' incorrectly extends interface 'Base2'. Types of property 'a3' are incompatible. Type 'new (x: T, y: T) => T' is not assignable to type 'new (x: T) => T'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(143,15): error TS2430: Interface 'I11' incorrectly extends interface 'Base2'. The types returned by 'new a4(...)' are incompatible between these types. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. @@ -97,9 +101,11 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(196,15): error TS2430: Interface 'I3' incorrectly extends interface 'Base2'. Types of property 'a' are incompatible. Type 'new (x: T) => T' is not assignable to type 'new () => T'. + Target signature provides too few arguments. Expected 1 or more, but got 0. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(226,15): error TS2430: Interface 'I10' incorrectly extends interface 'Base2'. Types of property 'a3' are incompatible. Type 'new (x: T, y: T) => T' is not assignable to type 'new (x: T) => T'. + Target signature provides too few arguments. Expected 2 or more, but got 1. ==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts (22 errors) ==== @@ -127,6 +133,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Interface 'I3' incorrectly extends interface 'Base'. !!! error TS2430: Types of property 'a' are incompatible. !!! error TS2430: Type 'new (x: T) => T' is not assignable to type 'new () => T'. +!!! error TS2430: Target signature provides too few arguments. Expected 1 or more, but got 0. a: new (x: T) => T; // error, too many required params } @@ -161,6 +168,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Interface 'I10' incorrectly extends interface 'Base'. !!! error TS2430: Types of property 'a3' are incompatible. !!! error TS2430: Type 'new (x: T, y: T) => T' is not assignable to type 'new (x: T) => T'. +!!! error TS2430: Target signature provides too few arguments. Expected 2 or more, but got 1. a3: new (x: T, y: T) => T; // error, too many required params } @@ -235,6 +243,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Interface 'I3' incorrectly extends interface 'Base2'. !!! error TS2430: Types of property 'a' are incompatible. !!! error TS2430: Type 'new (x: T) => T' is not assignable to type 'new () => T'. +!!! error TS2430: Target signature provides too few arguments. Expected 1 or more, but got 0. a: new (x: T) => T; } @@ -313,6 +322,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Interface 'I10' incorrectly extends interface 'Base2'. !!! error TS2430: Types of property 'a3' are incompatible. !!! error TS2430: Type 'new (x: T, y: T) => T' is not assignable to type 'new (x: T) => T'. +!!! error TS2430: Target signature provides too few arguments. Expected 2 or more, but got 1. a3: new (x: T, y: T) => T; } @@ -435,6 +445,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Interface 'I3' incorrectly extends interface 'Base2'. !!! error TS2430: Types of property 'a' are incompatible. !!! error TS2430: Type 'new (x: T) => T' is not assignable to type 'new () => T'. +!!! error TS2430: Target signature provides too few arguments. Expected 1 or more, but got 0. a: new (x: T) => T; // error, not identical and contextual signature instatiation can't make inference from T to T } @@ -469,6 +480,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Interface 'I10' incorrectly extends interface 'Base2'. !!! error TS2430: Types of property 'a3' are incompatible. !!! error TS2430: Type 'new (x: T, y: T) => T' is not assignable to type 'new (x: T) => T'. +!!! error TS2430: Target signature provides too few arguments. Expected 2 or more, but got 1. a3: new (x: T, y: T) => T; // error, too many required params } diff --git a/tests/baselines/reference/tsxStatelessFunctionComponentsWithTypeArguments2.errors.txt b/tests/baselines/reference/tsxStatelessFunctionComponentsWithTypeArguments2.errors.txt index f3ce91abd95..02779d7d588 100644 --- a/tests/baselines/reference/tsxStatelessFunctionComponentsWithTypeArguments2.errors.txt +++ b/tests/baselines/reference/tsxStatelessFunctionComponentsWithTypeArguments2.errors.txt @@ -5,6 +5,7 @@ tests/cases/conformance/jsx/file.tsx(8,15): error TS2322: Type 'T & { "ignore-pr tests/cases/conformance/jsx/file.tsx(13,15): error TS2322: Type 'T' is not assignable to type 'IntrinsicAttributes & { prop: unknown; "ignore-prop": string; }'. Type 'T' is not assignable to type '{ prop: unknown; "ignore-prop": string; }'. tests/cases/conformance/jsx/file.tsx(20,19): error TS2322: Type '(a: number, b: string) => void' is not assignable to type '(arg: number) => void'. + Target signature provides too few arguments. Expected 2 or more, but got 1. tests/cases/conformance/jsx/file.tsx(31,52): error TS2322: Type '(val: string) => void' is not assignable to type '(selectedVal: number) => void'. Types of parameters 'val' and 'selectedVal' are incompatible. Type 'number' is not assignable to type 'string'. @@ -43,6 +44,7 @@ tests/cases/conformance/jsx/file.tsx(31,52): error TS2322: Type '(val: string) = let o = ~~~~ !!! error TS2322: Type '(a: number, b: string) => void' is not assignable to type '(arg: number) => void'. +!!! error TS2322: Target signature provides too few arguments. Expected 2 or more, but got 1. !!! related TS6500 tests/cases/conformance/jsx/file.tsx:16:30: The expected type comes from property 'func' which is declared here on type 'IntrinsicAttributes & { func: (arg: number) => void; }' } diff --git a/tests/baselines/reference/typeGuardFunctionErrors.errors.txt b/tests/baselines/reference/typeGuardFunctionErrors.errors.txt index a51a2607e9a..ff0aad32daa 100644 --- a/tests/baselines/reference/typeGuardFunctionErrors.errors.txt +++ b/tests/baselines/reference/typeGuardFunctionErrors.errors.txt @@ -27,6 +27,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(84,1): Type predicate 'p2 is A' is not assignable to 'p1 is A'. Parameter 'p2' is not in the same position as parameter 'p1'. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(90,1): error TS2322: Type '(p1: any, p2: any, p3: any) => p1 is A' is not assignable to type '(p1: any, p2: any) => p1 is A'. + Target signature provides too few arguments. Expected 3 or more, but got 2. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(95,9): error TS2749: 'b' refers to a value, but is being used as a type here. Did you mean 'typeof b'? tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(95,11): error TS1005: ',' expected. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(95,14): error TS1005: ',' expected. @@ -211,6 +212,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(166,54 assign3 = function(p1, p2, p3): p1 is A { ~~~~~~~ !!! error TS2322: Type '(p1: any, p2: any, p3: any) => p1 is A' is not assignable to type '(p1: any, p2: any) => p1 is A'. +!!! error TS2322: Target signature provides too few arguments. Expected 3 or more, but got 2. return true; }; diff --git a/tests/cases/compiler/signatureLengthMismatchCall.ts b/tests/cases/compiler/signatureLengthMismatchCall.ts new file mode 100644 index 00000000000..0d39190a76f --- /dev/null +++ b/tests/cases/compiler/signatureLengthMismatchCall.ts @@ -0,0 +1,5 @@ +function takesCallback(fn: (a: number) => void) { + // ... +} + +takesCallback((a: number, b: number) => {}); diff --git a/tests/cases/compiler/signatureLengthMismatchInOverload.ts b/tests/cases/compiler/signatureLengthMismatchInOverload.ts new file mode 100644 index 00000000000..cd63db64b39 --- /dev/null +++ b/tests/cases/compiler/signatureLengthMismatchInOverload.ts @@ -0,0 +1,5 @@ +function f(callback: (arg: string, arg2: string) => void): void; +function f(callback: (arg: number) => void): void; +function f(callback: unknown) { } + +f((arg: number, arg2: number) => {}); diff --git a/tests/cases/compiler/signatureLengthMismatchWithOptionalParameters.ts b/tests/cases/compiler/signatureLengthMismatchWithOptionalParameters.ts new file mode 100644 index 00000000000..be021449abd --- /dev/null +++ b/tests/cases/compiler/signatureLengthMismatchWithOptionalParameters.ts @@ -0,0 +1,5 @@ +function callee(n: number | undefined, m: string) { } + +function caller(arg: (n?: number) => void) { } + +caller(callee);