mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-14 19:16:17 -06:00
Merge pull request #242 from Microsoft/argumentTypeErrors
Better error messages in function calls.
This commit is contained in:
commit
e0b33127b4
@ -3634,9 +3634,8 @@ module ts {
|
||||
(!node.typeArguments || signature.typeParameters && node.typeArguments.length === signature.typeParameters.length);
|
||||
}
|
||||
|
||||
// The candidate list is in reverse order of declaration, except that groups of signatures with the same parent are
|
||||
// kept in declaration order.
|
||||
function collectCandidates(node: CallExpression, signatures: Signature[]): Signature[] {
|
||||
// The candidate list orders groups in reverse, but within a group signatures are kept in declaration order
|
||||
function collectCandidates(node: CallExpression, signatures: Signature[]): Signature[]{
|
||||
var result: Signature[] = [];
|
||||
var lastParent: Node;
|
||||
var pos: number;
|
||||
@ -3733,15 +3732,22 @@ module ts {
|
||||
return result;
|
||||
}
|
||||
|
||||
function isApplicableSignature(node: CallExpression, signature: Signature, relation: Map<boolean>, excludeArgument: boolean[]) {
|
||||
function checkApplicableSignature(node: CallExpression, signature: Signature, relation: Map<boolean>, excludeArgument: boolean[], reportErrors: boolean) {
|
||||
if (node.arguments) {
|
||||
for (var i = 0; i < node.arguments.length; i++) {
|
||||
var arg = node.arguments[i];
|
||||
var paramType = getTypeAtPosition(signature, i);
|
||||
var argType = arg.kind === SyntaxKind.StringLiteral ?
|
||||
// String literals get string literal types unless we're reporting errors
|
||||
var argType = arg.kind === SyntaxKind.StringLiteral && !reportErrors ?
|
||||
getStringLiteralType(<LiteralExpression>arg) :
|
||||
checkExpression(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined);
|
||||
if (!isTypeRelatedTo(argType, paramType, relation)) return false;
|
||||
// Use argument expression as error location when reporting errors
|
||||
var isValidArgument = checkTypeRelatedTo(argType, paramType, relation, reportErrors ? arg : undefined,
|
||||
Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1,
|
||||
Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1);
|
||||
if (!isValidArgument) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -3773,7 +3779,9 @@ module ts {
|
||||
inferTypeArguments(candidate, args, excludeArgument);
|
||||
candidate = getSignatureInstantiation(candidate, typeArguments);
|
||||
}
|
||||
if (!isApplicableSignature(node, candidate, relation, excludeArgument)) break;
|
||||
if (!checkApplicableSignature(node, candidate, relation, excludeArgument, /*reportErrors*/ false)) {
|
||||
break;
|
||||
}
|
||||
var index = excludeArgument ? indexOf(excludeArgument, true) : -1;
|
||||
if (index < 0) {
|
||||
return getReturnTypeOfSignature(candidate);
|
||||
@ -3781,10 +3789,14 @@ module ts {
|
||||
excludeArgument[index] = false;
|
||||
}
|
||||
}
|
||||
if (relation === assignableRelation) break;
|
||||
if (relation === assignableRelation) {
|
||||
break;
|
||||
}
|
||||
relation = assignableRelation;
|
||||
}
|
||||
error(node, Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target);
|
||||
// No signatures were applicable. Now report errors based on the last applicable signature with
|
||||
// no arguments excluded from assignability checks.
|
||||
checkApplicableSignature(node, candidate, relation, undefined, /*reportErrors*/ true);
|
||||
return checkErrorCall(node);
|
||||
}
|
||||
|
||||
|
||||
@ -195,6 +195,7 @@ module ts {
|
||||
Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { code: 3033, category: DiagnosticCategory.Error, key: "Specialized overload signature is not assignable to any non-specialized signature." },
|
||||
Duplicate_function_implementation: { code: 3034, category: DiagnosticCategory.Error, key: "Duplicate function implementation." },
|
||||
Overload_signature_is_not_compatible_with_function_implementation: { code: 3035, category: DiagnosticCategory.Error, key: "Overload signature is not compatible with function implementation." },
|
||||
Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 3036, category: DiagnosticCategory.Error, key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." },
|
||||
Index_signature_is_missing_in_type_0: { code: 4003, category: DiagnosticCategory.Error, key: "Index signature is missing in type '{0}'." },
|
||||
Index_signatures_are_incompatible_Colon: { code: 4004, category: DiagnosticCategory.Error, key: "Index signatures are incompatible:" },
|
||||
Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 4016, category: DiagnosticCategory.NoPrefix, key: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." },
|
||||
|
||||
@ -772,7 +772,10 @@
|
||||
"category": "Error",
|
||||
"code": 3035
|
||||
},
|
||||
|
||||
"Argument of type '{0}' is not assignable to parameter of type '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 3036
|
||||
},
|
||||
|
||||
|
||||
"Index signature is missing in type '{0}'.": {
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
|
||||
|
||||
var xx = new a(null, 7, new B());
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~
|
||||
!!! Argument of type 'B' is not assignable to parameter of type 'B[]'.
|
||||
|
||||
|
||||
@ -27,8 +27,9 @@
|
||||
|
||||
var arr = [new Giraffe(), new Elephant()];
|
||||
foo(arr); // Error because of no contextual type
|
||||
~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~
|
||||
!!! Argument of type '{}[]' is not assignable to parameter of type 'IAnimal[]'.
|
||||
!!! Type '{}' is not assignable to type 'IAnimal'.
|
||||
bar(arr); // Error because of no contextual type
|
||||
~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~
|
||||
!!! Argument of type '{}[]' is not assignable to parameter of type '{ [x: number]: IAnimal; }'.
|
||||
@ -6,9 +6,11 @@
|
||||
function fn(cb: IResultCallback) { }
|
||||
|
||||
fn((a, b) => true);
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '(a: any, b: any) => boolean' is not assignable to parameter of type 'IResultCallback'.
|
||||
!!! Property 'x' is missing in type '(a: any, b: any) => boolean'.
|
||||
fn(function (a, b) { return true; })
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Argument of type '(a: any, b: any) => boolean' is not assignable to parameter of type 'IResultCallback'.
|
||||
!!! Property 'x' is missing in type '(a: any, b: any) => boolean'.
|
||||
|
||||
@ -1,20 +1,22 @@
|
||||
==== tests/cases/compiler/assignmentCompatBug5.ts (4 errors) ====
|
||||
function foo1(x: { a: number; }) { }
|
||||
foo1({ b: 5 });
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~
|
||||
!!! Argument of type '{ b: number; }' is not assignable to parameter of type '{ a: number; }'.
|
||||
!!! Property 'a' is missing in type '{ b: number; }'.
|
||||
|
||||
function foo2(x: number[]) { }
|
||||
foo2(["s", "t"]);
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~
|
||||
!!! Argument of type 'string[]' is not assignable to parameter of type 'number[]'.
|
||||
!!! Type 'string' is not assignable to type 'number'.
|
||||
|
||||
function foo3(x: (n: number) =>number) { };
|
||||
foo3((s:string) => { });
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! Argument of type '(s: string) => void' is not assignable to parameter of type '(n: number) => number'.
|
||||
foo3((n) => { return; });
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
!!! Argument of type '(n: number) => void' is not assignable to parameter of type '(n: number) => number'.
|
||||
|
||||
|
||||
@ -5,8 +5,11 @@
|
||||
foo({ id: 1234 }); // Ok
|
||||
foo({ id: 1234, name: "hello" }); // Ok
|
||||
foo({ id: 1234, name: false }); // Error, name of wrong type
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Argument of type '{ id: number; name: boolean; }' is not assignable to parameter of type '{ id: number; name?: string; }'.
|
||||
!!! Types of property 'name' are incompatible:
|
||||
!!! Type 'boolean' is not assignable to type 'string'.
|
||||
foo({ name: "hello" }); // Error, id required but missing
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! Argument of type '{ name: string; }' is not assignable to parameter of type '{ id: number; name?: string; }'.
|
||||
!!! Property 'id' is missing in type '{ name: string; }'.
|
||||
@ -14,6 +14,6 @@
|
||||
function Biz(map: IHandlerMap) { }
|
||||
|
||||
Biz(new Foo());
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~
|
||||
!!! Argument of type 'Foo' is not assignable to parameter of type 'IHandlerMap'.
|
||||
|
||||
@ -33,17 +33,18 @@
|
||||
|
||||
// Should Fail
|
||||
fn('');
|
||||
~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~
|
||||
!!! Argument of type 'string' is not assignable to parameter of type 'Applicable'.
|
||||
fn(['']);
|
||||
~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~
|
||||
!!! Argument of type 'string[]' is not assignable to parameter of type 'Applicable'.
|
||||
fn(4);
|
||||
~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'Applicable'.
|
||||
fn({});
|
||||
~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~
|
||||
!!! Argument of type '{}' is not assignable to parameter of type 'Applicable'.
|
||||
!!! Property 'apply' is missing in type '{}'.
|
||||
|
||||
|
||||
// Should work
|
||||
|
||||
@ -33,17 +33,18 @@
|
||||
|
||||
// Should Fail
|
||||
fn('');
|
||||
~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~
|
||||
!!! Argument of type 'string' is not assignable to parameter of type 'Callable'.
|
||||
fn(['']);
|
||||
~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~
|
||||
!!! Argument of type 'string[]' is not assignable to parameter of type 'Callable'.
|
||||
fn(4);
|
||||
~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'Callable'.
|
||||
fn({});
|
||||
~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~
|
||||
!!! Argument of type '{}' is not assignable to parameter of type 'Callable'.
|
||||
!!! Property 'call' is missing in type '{}'.
|
||||
|
||||
|
||||
// Should work
|
||||
|
||||
@ -26,8 +26,8 @@
|
||||
~~~~
|
||||
!!! 'this' cannot be referenced in current location.
|
||||
class F extends C { constructor(public z: number) { super("hello", this.z) } } // first param type
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~
|
||||
!!! Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
~~~~
|
||||
!!! 'this' cannot be referenced in current location.
|
||||
|
||||
|
||||
@ -8,6 +8,6 @@
|
||||
var test: I1<string>;
|
||||
test("expects boolean instead of string"); // should not error - "test" should not expect a boolean
|
||||
test(true); // should error - string expected
|
||||
~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~
|
||||
!!! Argument of type 'boolean' is not assignable to parameter of type 'string'.
|
||||
}
|
||||
@ -15,6 +15,6 @@
|
||||
// BUG 822524
|
||||
var r = x.foo(1); // no error
|
||||
var r2 = x.foo(''); // error
|
||||
~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~
|
||||
!!! Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
|
||||
@ -18,5 +18,5 @@
|
||||
|
||||
// Ok to go down the chain, but error to try to climb back up
|
||||
(new Chain(new A)).then(a => new B).then(b => new C).then(c => new B).then(b => new A);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~
|
||||
!!! Argument of type '(c: C) => B' is not assignable to parameter of type '(x: C) => C'.
|
||||
@ -6,13 +6,13 @@
|
||||
var s: S;
|
||||
// Ok to go down the chain, but error to climb up the chain
|
||||
(new Chain(t)).then(tt => s).then(ss => t);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~
|
||||
!!! Argument of type '(ss: S) => T' is not assignable to parameter of type '(x: S) => S'.
|
||||
|
||||
// But error to try to climb up the chain
|
||||
(new Chain(s)).then(ss => t);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~
|
||||
!!! Argument of type '(ss: S) => T' is not assignable to parameter of type '(x: S) => S'.
|
||||
|
||||
// Staying at T or S should be fine
|
||||
(new Chain(t)).then(tt => t).then(tt => t).then(tt => t);
|
||||
|
||||
@ -19,11 +19,11 @@
|
||||
var f1 = new Foo("hey");
|
||||
var f2 = new Foo(0);
|
||||
var f3 = new Foo(f1);
|
||||
~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~
|
||||
!!! Argument of type 'Foo' is not assignable to parameter of type 'number'.
|
||||
var f4 = new Foo([f1,f2,f3]);
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~
|
||||
!!! Argument of type 'unknown[]' is not assignable to parameter of type 'number'.
|
||||
|
||||
f1.bar1();
|
||||
f1.bar2();
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
==== tests/cases/compiler/contextualTyping30.ts (1 errors) ====
|
||||
function foo(param:number[]){}; foo([1, "a"]);
|
||||
~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~
|
||||
!!! Argument of type '{}[]' is not assignable to parameter of type 'number[]'.
|
||||
!!! Type '{}' is not assignable to type 'number'.
|
||||
@ -1,4 +1,5 @@
|
||||
==== tests/cases/compiler/contextualTyping33.ts (1 errors) ====
|
||||
function foo(param: {():number; (i:number):number; }[]) { }; foo([function(){return 1;}, function(){return "foo"}]);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Argument of type '{}[]' is not assignable to parameter of type '{ (): number; (i: number): number; }[]'.
|
||||
!!! Type '{}' is not assignable to type '{ (): number; (i: number): number; }'.
|
||||
@ -15,9 +15,9 @@
|
||||
// errors on all 3 lines, bug was that r5 was the only line with errors
|
||||
var f = (x: number) => { return x.toFixed() };
|
||||
var r5 = _.forEach<number>(c2, f);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type '(x: number) => string' is not assignable to parameter of type '(x: number) => Date'.
|
||||
var r6 = _.forEach<number>(c2, (x) => { return x.toFixed() });
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: number) => string' is not assignable to parameter of type '(x: number) => Date'.
|
||||
|
||||
@ -12,5 +12,5 @@
|
||||
f({}); // Ok
|
||||
f(obj1); // Ok
|
||||
f(obj2); // Error - indexer doesn't match
|
||||
~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~
|
||||
!!! Argument of type '{ x: string; }' is not assignable to parameter of type '{ [x: string]: string; }'.
|
||||
@ -3,8 +3,8 @@
|
||||
var n: number = f(4);
|
||||
n = f();
|
||||
var s: string = f('');
|
||||
~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~
|
||||
!!! Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
s = f();
|
||||
~
|
||||
!!! Type 'number' is not assignable to type 'string'.
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
==== tests/cases/conformance/externalModules/foo_1.ts (1 errors) ====
|
||||
import foo = require("./foo_0");
|
||||
var x = new foo(true); // Should error
|
||||
~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~
|
||||
!!! Argument of type 'boolean' is not assignable to parameter of type '{ a: string; b: number; }'.
|
||||
var y = new foo({a: "test", b: 42}); // Should be OK
|
||||
var z: number = y.test.b;
|
||||
==== tests/cases/conformance/externalModules/foo_0.ts (0 errors) ====
|
||||
|
||||
@ -2,10 +2,10 @@
|
||||
function foo(...a:number[]){};
|
||||
foo(0, 1);
|
||||
foo('foo');
|
||||
~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~
|
||||
!!! Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
foo();
|
||||
foo(1, 'bar');
|
||||
~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~
|
||||
!!! Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
|
||||
@ -6,8 +6,8 @@
|
||||
~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
foo(1, 'bar');
|
||||
~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
foo('foo', 1, 'bar');
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
|
||||
@ -6,10 +6,10 @@
|
||||
~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
foo(1, 'bar');
|
||||
~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
foo('foo', 1, 'bar');
|
||||
foo('foo', 1, 3);
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
foo(1, 'bar');
|
||||
~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
foo('foo', 1, 3);
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
foo('foo');
|
||||
foo();
|
||||
foo(1, 'bar');
|
||||
~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
foo('foo', 1, 3);
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
==== tests/cases/compiler/functionCall16.ts (3 errors) ====
|
||||
function foo(a:string, b?:string, ...c:number[]){}
|
||||
foo('foo', 1);
|
||||
~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
foo('foo');
|
||||
foo('foo', 'bar');
|
||||
foo();
|
||||
~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
foo(1, 'bar');
|
||||
~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
foo('foo', 'bar', 3);
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
==== tests/cases/compiler/functionCall17.ts (4 errors) ====
|
||||
function foo(a:string, b?:string, c?:number, ...d:number[]){}
|
||||
foo('foo', 1);
|
||||
~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
foo('foo');
|
||||
foo();
|
||||
~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
foo(1, 'bar');
|
||||
~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
foo('foo', 1, 3);
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
foo('foo', 'bar', 3, 4);
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
function foo(a:string){};
|
||||
foo('bar');
|
||||
foo(2);
|
||||
~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
foo('foo', 'bar');
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
|
||||
@ -7,8 +7,8 @@
|
||||
~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
foo(4);
|
||||
~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'c1'.
|
||||
foo();
|
||||
~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
foo(4);
|
||||
~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
foo();
|
||||
|
||||
@ -3,8 +3,8 @@
|
||||
foo('foo', 1);
|
||||
foo('foo');
|
||||
foo('foo','bar');
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~
|
||||
!!! Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
foo('foo', 1, 'bar');
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
|
||||
@ -4,8 +4,8 @@
|
||||
function foo<T extends Function>(x: T): T { return x; }
|
||||
|
||||
foo(1);
|
||||
~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'Function'.
|
||||
foo(() => { }, 1);
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
@ -28,42 +28,42 @@
|
||||
var b2: { new <T>(x: T): T };
|
||||
|
||||
var r = foo2(new Function());
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type 'Function' is not assignable to parameter of type '(x: string) => string'.
|
||||
var r2 = foo2((x: string[]) => x);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: string[]) => string[]' is not assignable to parameter of type '(x: string) => string'.
|
||||
var r6 = foo2(C);
|
||||
~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'typeof C' is not assignable to parameter of type '(x: string) => string'.
|
||||
var r7 = foo2(b);
|
||||
~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'new (x: string) => string' is not assignable to parameter of type '(x: string) => string'.
|
||||
var r8 = foo2(<U>(x: U) => x); // no error expected
|
||||
var r11 = foo2(<U, V>(x: U, y: V) => x);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Argument of type '<U, V>(x: U, y: V) => U' is not assignable to parameter of type '(x: string) => string'.
|
||||
var r13 = foo2(C2);
|
||||
~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~
|
||||
!!! Argument of type 'typeof C2' is not assignable to parameter of type '(x: string) => string'.
|
||||
var r14 = foo2(b2);
|
||||
~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~
|
||||
!!! Argument of type 'new <T>(x: T) => T' is not assignable to parameter of type '(x: string) => string'.
|
||||
|
||||
interface F2 extends Function { foo: string; }
|
||||
var f2: F2;
|
||||
var r16 = foo2(f2);
|
||||
~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~
|
||||
!!! Argument of type 'F2' is not assignable to parameter of type '(x: string) => string'.
|
||||
|
||||
function fff<T extends { (): void }, U extends T>(x: T, y: U) {
|
||||
~~~~~~~~~~~
|
||||
!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
||||
foo2(x);
|
||||
~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'T' is not assignable to parameter of type '(x: string) => string'.
|
||||
foo2(y);
|
||||
~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'U' is not assignable to parameter of type '(x: string) => string'.
|
||||
}
|
||||
|
||||
@ -3,5 +3,5 @@
|
||||
function foo(bar: string): number;
|
||||
function foo(bar?: string): any { return "" };
|
||||
var x = foo(5);
|
||||
~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
@ -3,5 +3,5 @@
|
||||
function foo(bar: number): number;
|
||||
function foo(bar: any): any { return bar };
|
||||
var x = foo(true);
|
||||
~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~
|
||||
!!! Argument of type 'boolean' is not assignable to parameter of type 'number'.
|
||||
@ -3,6 +3,6 @@
|
||||
function foo(bar:string):number;
|
||||
function foo(bar?:any):any{ return '' }
|
||||
var x = foo(5);
|
||||
~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
|
||||
@ -3,6 +3,9 @@
|
||||
function foo(bar:{a:boolean;}[]):number;
|
||||
function foo(bar:{a:any;}[]):any{ return bar }
|
||||
var x = foo([{a:'bar'}]);
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~
|
||||
!!! Argument of type '{ a: string; }[]' is not assignable to parameter of type '{ a: boolean; }[]'.
|
||||
!!! Type '{ a: string; }' is not assignable to type '{ a: boolean; }':
|
||||
!!! Types of property 'a' are incompatible:
|
||||
!!! Type 'string' is not assignable to type 'boolean'.
|
||||
|
||||
@ -3,6 +3,8 @@
|
||||
function foo(bar:{a:boolean;}[]):number;
|
||||
function foo(bar:{a:any;}[]):any{ return bar }
|
||||
var x = foo([{}]);
|
||||
~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~
|
||||
!!! Argument of type '{}[]' is not assignable to parameter of type '{ a: boolean; }[]'.
|
||||
!!! Type '{}' is not assignable to type '{ a: boolean; }':
|
||||
!!! Property 'a' is missing in type '{}'.
|
||||
|
||||
@ -12,6 +12,6 @@
|
||||
var r2 = foo(null); // {}
|
||||
var r3 = foo(new Object()); // {}
|
||||
var r4 = foo<Date, Date>(1); // error
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'Date'.
|
||||
var r5 = foo<Date, Date>(new Date()); // no error
|
||||
@ -10,12 +10,12 @@
|
||||
// more args not allowed
|
||||
var arg2: { cb: new <T>(x: T, y: T) => string };
|
||||
var r2 = foo(arg2); // error
|
||||
~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~
|
||||
!!! Argument of type '{ cb: new <T>(x: T, y: T) => string; }' is not assignable to parameter of type '{ cb: new (t: any) => string; }'.
|
||||
var arg3: { cb: new (x: string, y: number) => string };
|
||||
var r3 = foo(arg3); // error
|
||||
~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~
|
||||
!!! Argument of type '{ cb: new (x: string, y: number) => string; }' is not assignable to parameter of type '{ cb: new (t: string) => string; }'.
|
||||
|
||||
function foo2<T, U>(arg: { cb: new(t: T, t2: T) => U }) {
|
||||
return new arg.cb(null, null);
|
||||
|
||||
@ -9,11 +9,15 @@
|
||||
var r = foo(arg); // {}
|
||||
// more args not allowed
|
||||
var r2 = foo({ cb: <T>(x: T, y: T) => '' }); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Argument of type '{ cb: <T>(x: T, y: T) => string; }' is not assignable to parameter of type '{ cb: (t: any) => string; }'.
|
||||
!!! Types of property 'cb' are incompatible:
|
||||
!!! Type '<T>(x: T, y: T) => string' is not assignable to type '(t: any) => string'.
|
||||
var r3 = foo({ cb: (x: string, y: number) => '' }); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Argument of type '{ cb: (x: string, y: number) => string; }' is not assignable to parameter of type '{ cb: (t: string) => string; }'.
|
||||
!!! Types of property 'cb' are incompatible:
|
||||
!!! Type '(x: string, y: number) => string' is not assignable to type '(t: string) => string'.
|
||||
|
||||
function foo2<T, U>(arg: { cb: (t: T, t2: T) => U }) {
|
||||
return arg.cb(null, null);
|
||||
|
||||
@ -13,11 +13,11 @@
|
||||
var r7 = foo((a: T) => a, (b: T) => b); // T => T
|
||||
// BUG 835518
|
||||
var r9 = r7(new Date()); // should be ok
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~
|
||||
!!! Argument of type 'Date' is not assignable to parameter of type 'T'.
|
||||
var r10 = r7(1); // error
|
||||
~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'T'.
|
||||
}
|
||||
|
||||
function foo2<T extends Date>(a: (x: T) => T, b: (x: T) => T) {
|
||||
@ -27,8 +27,8 @@
|
||||
|
||||
function other3<T extends RegExp>(x: T) {
|
||||
var r7 = foo2((a: T) => a, (b: T) => b); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~
|
||||
!!! Argument of type '(a: T) => T' is not assignable to parameter of type '(x: Date) => Date'.
|
||||
var r7b = foo2((a) => a, (b) => b); // valid, T is inferred to be Date
|
||||
}
|
||||
|
||||
@ -41,5 +41,5 @@
|
||||
}
|
||||
|
||||
var r7 = foo3(E.A, (x) => E.A, (x) => F.A); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~
|
||||
!!! Argument of type '(x: E) => F' is not assignable to parameter of type '(x: E) => E'.
|
||||
@ -3,14 +3,22 @@
|
||||
var x = foo({ x: 3, y: "" }, 4); // no error, x is Object, the best common type
|
||||
// these are all errors
|
||||
var x2 = foo<number>({ x: 3, y: "" }, 4);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Argument of type '{ x: number; y: string; }' is not assignable to parameter of type '{ x: number; y: number; }'.
|
||||
!!! Types of property 'y' are incompatible:
|
||||
!!! Type 'string' is not assignable to type 'number'.
|
||||
var x3 = foo<string>({ x: 3, y: "" }, 4);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Argument of type '{ x: number; y: string; }' is not assignable to parameter of type '{ x: string; y: string; }'.
|
||||
!!! Types of property 'x' are incompatible:
|
||||
!!! Type 'number' is not assignable to type 'string'.
|
||||
var x4 = foo<number>({ x: "", y: 4 }, "");
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Argument of type '{ x: string; y: number; }' is not assignable to parameter of type '{ x: number; y: number; }'.
|
||||
!!! Types of property 'x' are incompatible:
|
||||
!!! Type 'string' is not assignable to type 'number'.
|
||||
var x5 = foo<string>({ x: "", y: 4 }, "");
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Argument of type '{ x: string; y: number; }' is not assignable to parameter of type '{ x: string; y: string; }'.
|
||||
!!! Types of property 'y' are incompatible:
|
||||
!!! Type 'number' is not assignable to type 'string'.
|
||||
@ -33,8 +33,8 @@
|
||||
!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
||||
var r4 = foo(c, d);
|
||||
var r5 = foo<T, U>(c, d); // error
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'C' is not assignable to parameter of type 'T'.
|
||||
}
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
~~~~~~~~~~~
|
||||
!!! Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
||||
var r5 = foo<T, U>(c, d); // error
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'C' is not assignable to parameter of type 'T'.
|
||||
}
|
||||
|
||||
@ -30,8 +30,8 @@
|
||||
|
||||
var b: { new <T>(x: T, y: T): string };
|
||||
var r10 = foo6(b); // error
|
||||
~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'new <T>(x: T, y: T) => string' is not assignable to parameter of type '{ new (x: any): string; new (x: any, y?: any): string; }'.
|
||||
|
||||
function foo7<T>(x:T, cb: { new(x: T): string; new(x: T, y?: T): string }) {
|
||||
return cb;
|
||||
|
||||
@ -27,8 +27,8 @@
|
||||
}
|
||||
|
||||
var r10 = foo6(<T>(x: T, y: T) => ''); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Argument of type '<T>(x: T, y: T) => string' is not assignable to parameter of type '{ (x: any): string; (x: any, y?: any): string; }'.
|
||||
|
||||
function foo7<T>(x:T, cb: { (x: T): string; (x: T, y?: T): string }) {
|
||||
return cb;
|
||||
|
||||
@ -4,8 +4,8 @@
|
||||
~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
var r2 = f(1);
|
||||
~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'T'.
|
||||
var r3 = f<any>(null);
|
||||
~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
@ -21,8 +21,8 @@
|
||||
var r41 = f(null);
|
||||
|
||||
var r12 = f(y);
|
||||
~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'U' is not assignable to parameter of type 'T'.
|
||||
var r22 = f<number>(y);
|
||||
~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
|
||||
@ -14,8 +14,8 @@
|
||||
var c2: Collection<number, string>;
|
||||
var rf1 = (x: number, y: string) => { return x.toFixed() };
|
||||
var r5a = _.map<number, string, Date>(c2, (x, y) => { return x.toFixed() });
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: number, y: string) => string' is not assignable to parameter of type '(x: number, y: string) => Date'.
|
||||
var r5b = _.map<number, string, Date>(c2, rf1);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~
|
||||
!!! Argument of type '(x: number, y: string) => string' is not assignable to parameter of type '(x: number, y: string) => Date'.
|
||||
@ -5,6 +5,8 @@
|
||||
|
||||
var x: I<{s: string}>
|
||||
x.f({s: 1})
|
||||
~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~
|
||||
!!! Argument of type '{ s: number; }' is not assignable to parameter of type '{ s: string; }'.
|
||||
!!! Types of property 's' are incompatible:
|
||||
!!! Type 'number' is not assignable to type 'string'.
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
==== tests/cases/compiler/genericNewInterface.ts (2 errors) ====
|
||||
function createInstance<T>(ctor: new (s: string) => T): T {
|
||||
return new ctor(42); //should be an error
|
||||
~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
}
|
||||
|
||||
interface INewable<T> {
|
||||
@ -11,6 +11,6 @@
|
||||
|
||||
function createInstance2<T>(ctor: INewable<T>): T {
|
||||
return new ctor(1024); //should be an error
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
}
|
||||
@ -4,8 +4,8 @@
|
||||
var a1Gb = makeArrayG<any>(1, "");
|
||||
var a1Gc = makeArrayG<Object>(1, "");
|
||||
var a1Gd = makeArrayG<number>(1, ""); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~
|
||||
!!! Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
|
||||
function makeArrayGOpt<T>(item1?: T, item2?: T, item3?: T) {
|
||||
return [item1, item2, item3];
|
||||
@ -13,5 +13,5 @@
|
||||
var a2Ga = makeArrayGOpt(1, "");
|
||||
var a2Gb = makeArrayG<any>(1, "");
|
||||
var a2Gc = makeArrayG<any[]>(1, ""); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'any[]'.
|
||||
@ -6,8 +6,8 @@
|
||||
var x: B<number>;
|
||||
x.foo(1); // no error
|
||||
var f = <T>(x: B<T>) => { return x.foo(1); } // error
|
||||
~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'T'.
|
||||
var f2 = <T>(x: B<T>) => { return x.foo<T>(1); } // error
|
||||
~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
|
||||
@ -8,7 +8,8 @@
|
||||
this.test(["hi"]);
|
||||
this.test([]);
|
||||
this.test([1, 2, "hi", 5]); // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Argument of type '{}[]' is not assignable to parameter of type 'string[]'.
|
||||
!!! Type '{}' is not assignable to type 'string'.
|
||||
}
|
||||
}
|
||||
@ -61,8 +61,8 @@
|
||||
var c1: C1;
|
||||
var c2: C2;
|
||||
if1(c1);
|
||||
~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~
|
||||
!!! Argument of type 'C1' is not assignable to parameter of type 'IFoo2'.
|
||||
|
||||
|
||||
function of1(n: { a: { a: string; }; b: string; }): number;
|
||||
@ -70,8 +70,9 @@
|
||||
function of1(a: any) { return null; }
|
||||
|
||||
of1({ e: 0, f: 0 });
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '{ e: number; f: number; }' is not assignable to parameter of type '{ c: { b: string; }; d: string; }'.
|
||||
!!! Property 'c' is missing in type '{ e: number; f: number; }'.
|
||||
|
||||
interface IMap {
|
||||
[key:string]:string;
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
var v1 = numberMapToArray(numberMap); // Ok
|
||||
var v1 = numberMapToArray(stringMap); // Ok
|
||||
var v1 = stringMapToArray(numberMap); // Error expected here
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~
|
||||
!!! Argument of type 'NumberMap<Function>' is not assignable to parameter of type 'StringMap<{}>'.
|
||||
var v1 = stringMapToArray(stringMap); // Ok
|
||||
|
||||
@ -12,8 +12,8 @@
|
||||
|
||||
// Errors
|
||||
new Derived("", 3);
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
new Derived(3);
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
@ -31,11 +31,11 @@
|
||||
|
||||
// Errors
|
||||
new Derived(3);
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
new Derived("", 3, "", 3);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
new Derived("", 3, "", "");
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
@ -31,8 +31,8 @@
|
||||
x[2]={ color:Color.Green };
|
||||
|
||||
x=x.sort(CompareYeux); // parameter mismatch
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~
|
||||
!!! Argument of type '(a: IFrenchEye, b: IFrenchEye) => number' is not assignable to parameter of type '(a: IEye, b: IEye) => number'.
|
||||
// type of z inferred from specialized array type
|
||||
var z=x.sort(CompareEyes); // ok
|
||||
|
||||
|
||||
@ -2,6 +2,6 @@
|
||||
function foo1(val: string) {
|
||||
}
|
||||
function foo3(x = foo1(123)) { //should error, 123 is not string
|
||||
~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
}
|
||||
@ -30,8 +30,8 @@
|
||||
!!! Cannot find name 'ItemSet'.
|
||||
|
||||
super.add(listener);
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~
|
||||
!!! Argument of type '(items: unknown) => void' is not assignable to parameter of type '() => any'.
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
});
|
||||
|
||||
test({ // Should be OK. Last 'thunk' is of correct type
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
thunk: (num: number) => {},
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
thunk: (str: string) => {}
|
||||
@ -21,6 +21,10 @@
|
||||
~~~~~
|
||||
!!! Duplicate identifier 'thunk'.
|
||||
});
|
||||
~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type '{ thunk: (num: number) => void; }' is not assignable to parameter of type 'Thing'.
|
||||
!!! Types of property 'thunk' are incompatible:
|
||||
!!! Type '(num: number) => void' is not assignable to type '(str: string) => void':
|
||||
!!! Types of parameters 'num' and 'str' are incompatible:
|
||||
!!! Type 'number' is not assignable to type 'string'.
|
||||
|
||||
@ -9,5 +9,5 @@
|
||||
}
|
||||
var max2: Comparer = (x, y) => { return (x.compareTo(y) > 0) ? x : y };
|
||||
var maxResult = max2(1, 2);
|
||||
~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'Comparable<unknown>'.
|
||||
@ -9,8 +9,9 @@
|
||||
var r5 = map<any, any>([1, ""], (x) => x.toString());
|
||||
var r6 = map<Object, Object>([1, ""], (x) => x.toString());
|
||||
var r7 = map<number, string>([1, ""], (x) => x.toString()); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~
|
||||
!!! Argument of type '{}[]' is not assignable to parameter of type 'number[]'.
|
||||
!!! Type '{}' is not assignable to type 'number'.
|
||||
var r7b = map<number>([1, ""], (x) => x.toString()); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
|
||||
@ -3,11 +3,11 @@
|
||||
constructor(public foo: string) { }
|
||||
}
|
||||
var one = new Bar({}); // Error
|
||||
~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~
|
||||
!!! Argument of type '{}' is not assignable to parameter of type 'string'.
|
||||
[].forEach(() => {
|
||||
var two = new Bar({}); // No error?
|
||||
~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~
|
||||
!!! Argument of type '{}' is not assignable to parameter of type 'string'.
|
||||
});
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
f1(3);
|
||||
f2(3); // error no coercion to string
|
||||
~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
f2(3+""); // ok + operator promotes
|
||||
|
||||
@ -4,8 +4,8 @@
|
||||
}
|
||||
}
|
||||
function foo(x = new A(123)) { //should error, 123 is not string
|
||||
~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
}}
|
||||
~
|
||||
!!! Declaration or statement expected.
|
||||
@ -4,5 +4,7 @@
|
||||
}
|
||||
|
||||
process({a:true,b:"y"});
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '{ a: boolean; b: string; }' is not assignable to parameter of type '{ a: number; b: string; }'.
|
||||
!!! Types of property 'a' are incompatible:
|
||||
!!! Type 'boolean' is not assignable to type 'number'.
|
||||
@ -7,16 +7,19 @@
|
||||
function f2(args: I) { }
|
||||
|
||||
f2({ hello: 1 }) // error
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~
|
||||
!!! Argument of type '{ hello: number; }' is not assignable to parameter of type 'I'.
|
||||
!!! Property 'value' is missing in type '{ hello: number; }'.
|
||||
f2({ value: '' }) // missing toString satisfied by Object's member
|
||||
f2({ value: '', what: 1 }) // missing toString satisfied by Object's member
|
||||
f2({ toString: (s) => s }) // error, missing property value from ArgsString
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Argument of type '{ toString: (s: string) => string; }' is not assignable to parameter of type 'I'.
|
||||
!!! Property 'value' is missing in type '{ toString: (s: string) => string; }'.
|
||||
f2({ toString: (s: string) => s }) // error, missing property value from ArgsString
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Argument of type '{ toString: (s: string) => string; }' is not assignable to parameter of type 'I'.
|
||||
!!! Property 'value' is missing in type '{ toString: (s: string) => string; }'.
|
||||
f2({ value: '', toString: (s) => s.uhhh }) // error
|
||||
~~~~
|
||||
!!! Property 'uhhh' does not exist on type 'string'.
|
||||
@ -7,20 +7,26 @@
|
||||
function f2(args: I2) { }
|
||||
|
||||
f2({ hello: 1 })
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~
|
||||
!!! Argument of type '{ hello: number; }' is not assignable to parameter of type 'I2'.
|
||||
!!! Property 'value' is missing in type '{ hello: number; }'.
|
||||
f2({ value: '' })
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~
|
||||
!!! Argument of type '{ value: string; }' is not assignable to parameter of type 'I2'.
|
||||
!!! Property 'doStuff' is missing in type '{ value: string; }'.
|
||||
f2({ value: '', what: 1 })
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Argument of type '{ value: string; what: number; }' is not assignable to parameter of type 'I2'.
|
||||
!!! Property 'doStuff' is missing in type '{ value: string; what: number; }'.
|
||||
f2({ toString: (s) => s })
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Argument of type '{ toString: (s: any) => any; }' is not assignable to parameter of type 'I2'.
|
||||
!!! Property 'value' is missing in type '{ toString: (s: any) => any; }'.
|
||||
f2({ toString: (s: string) => s })
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Argument of type '{ toString: (s: string) => string; }' is not assignable to parameter of type 'I2'.
|
||||
!!! Property 'value' is missing in type '{ toString: (s: string) => string; }'.
|
||||
f2({ value: '', toString: (s) => s.uhhh })
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Argument of type '{ value: string; toString: (s: any) => any; }' is not assignable to parameter of type 'I2'.
|
||||
!!! Property 'doStuff' is missing in type '{ value: string; toString: (s: any) => any; }'.
|
||||
@ -43,8 +43,8 @@
|
||||
~
|
||||
!!! Type 'C' is not assignable to type 'string'.
|
||||
z=x.h(2,2); // no match
|
||||
~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
z=x.h("hello",0); // good
|
||||
|
||||
var v=x.g;
|
||||
|
||||
@ -12,8 +12,8 @@
|
||||
cb(hm);
|
||||
cb('uh');
|
||||
cb(1); // error
|
||||
~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
}
|
||||
|
||||
var cb: (number) => number = (x: number) => 1;
|
||||
|
||||
@ -15,8 +15,8 @@
|
||||
var hm = "hm";
|
||||
callback(hm);
|
||||
callback(1); // error
|
||||
~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -16,5 +16,5 @@
|
||||
!!! A signature with an implementation cannot use a string literal type.
|
||||
|
||||
foo("HI");
|
||||
~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~
|
||||
!!! Argument of type 'string' is not assignable to parameter of type '"SPAN"'.
|
||||
@ -26,8 +26,8 @@
|
||||
|
||||
// No candidate overloads found
|
||||
fn1({}); // Error
|
||||
~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~
|
||||
!!! Argument of type '{}' is not assignable to parameter of type 'number'.
|
||||
|
||||
// Generic and non - generic overload where generic overload is the only candidate when called with type arguments
|
||||
function fn2(s: string, n: number): number;
|
||||
@ -42,8 +42,8 @@
|
||||
|
||||
// Generic and non - generic overload where non - generic overload is the only candidate when called with type arguments
|
||||
fn2<Date>('', 0); // Error
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~
|
||||
!!! Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
|
||||
// Generic and non - generic overload where non - generic overload is the only candidate when called without type arguments
|
||||
fn2('', 0); // OK
|
||||
@ -75,19 +75,19 @@
|
||||
function fn4() { }
|
||||
fn4<string, number>('', 3);
|
||||
fn4<string, number>(3, ''); // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~
|
||||
!!! Type 'string' does not satisfy the constraint 'number'.
|
||||
~~~~~~
|
||||
!!! Type 'number' does not satisfy the constraint 'string'.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
fn4<number, string>('', 3); // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~
|
||||
!!! Type 'number' does not satisfy the constraint 'string'.
|
||||
~~~~~~
|
||||
!!! Type 'string' does not satisfy the constraint 'number'.
|
||||
~~
|
||||
!!! Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
fn4<number, string>(3, '');
|
||||
~~~~~~
|
||||
!!! Type 'number' does not satisfy the constraint 'string'.
|
||||
@ -109,11 +109,11 @@
|
||||
|
||||
// Generic overloads with constraints called without type arguments but with types that do not satisfy the constraints
|
||||
fn4(true, null); // Error
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~
|
||||
!!! Argument of type 'boolean' is not assignable to parameter of type 'number'.
|
||||
fn4(null, true); // Error
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~
|
||||
!!! Argument of type 'boolean' is not assignable to parameter of type 'string'.
|
||||
|
||||
// Non - generic overloads where contextual typing of function arguments has errors
|
||||
function fn5(f: (n: string) => void): string;
|
||||
|
||||
@ -26,8 +26,8 @@
|
||||
|
||||
// No candidate overloads found
|
||||
new fn1({}); // Error
|
||||
~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~
|
||||
!!! Argument of type '{}' is not assignable to parameter of type 'number'.
|
||||
|
||||
// Generic and non - generic overload where generic overload is the only candidate when called with type arguments
|
||||
class fn2<T> {
|
||||
@ -80,15 +80,15 @@
|
||||
}
|
||||
new fn4<string, number>('', 3);
|
||||
new fn4<string, number>(3, ''); // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
new fn4<number, string>('', 3); // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~
|
||||
!!! Type 'number' does not satisfy the constraint 'string'.
|
||||
~~~~~~
|
||||
!!! Type 'string' does not satisfy the constraint 'number'.
|
||||
~~
|
||||
!!! Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
new fn4<number, string>(3, ''); // Error
|
||||
~~~~~~
|
||||
!!! Type 'number' does not satisfy the constraint 'string'.
|
||||
@ -98,11 +98,11 @@
|
||||
// Generic overloads with constraints called without type arguments but with types that satisfy the constraints
|
||||
new fn4('', 3);
|
||||
new fn4(3, ''); // Error
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
new fn4(3, undefined); // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
new fn4('', null);
|
||||
|
||||
// Generic overloads with constraints called with type arguments that do not satisfy the constraints
|
||||
@ -114,11 +114,11 @@
|
||||
|
||||
// Generic overloads with constraints called without type arguments but with types that do not satisfy the constraints
|
||||
new fn4(true, null); // Error
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~
|
||||
!!! Argument of type 'boolean' is not assignable to parameter of type 'string'.
|
||||
new fn4(null, true); // Error
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~
|
||||
!!! Argument of type 'boolean' is not assignable to parameter of type 'number'.
|
||||
|
||||
// Non - generic overloads where contextual typing of function arguments has errors
|
||||
class fn5 {
|
||||
|
||||
@ -26,8 +26,8 @@
|
||||
|
||||
// No candidate overloads found
|
||||
new fn1({}); // Error
|
||||
~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~
|
||||
!!! Argument of type '{}' is not assignable to parameter of type 'number'.
|
||||
|
||||
// Generic and non - generic overload where generic overload is the only candidate when called with type arguments
|
||||
interface fn2 {
|
||||
@ -44,8 +44,8 @@
|
||||
|
||||
// Generic and non - generic overload where non - generic overload is the only candidate when called with type arguments
|
||||
new fn2<Date>('', 0); // Error
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~
|
||||
!!! Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
|
||||
// Generic and non - generic overload where non - generic overload is the only candidate when called without type arguments
|
||||
new fn2('', 0); // OK
|
||||
@ -82,19 +82,19 @@
|
||||
|
||||
new fn4<string, number>('', 3);
|
||||
new fn4<string, number>(3, ''); // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~
|
||||
!!! Type 'string' does not satisfy the constraint 'number'.
|
||||
~~~~~~
|
||||
!!! Type 'number' does not satisfy the constraint 'string'.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
new fn4<number, string>('', 3); // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~
|
||||
!!! Type 'number' does not satisfy the constraint 'string'.
|
||||
~~~~~~
|
||||
!!! Type 'string' does not satisfy the constraint 'number'.
|
||||
~~
|
||||
!!! Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
new fn4<number, string>(3, '');
|
||||
~~~~~~
|
||||
!!! Type 'number' does not satisfy the constraint 'string'.
|
||||
@ -116,11 +116,11 @@
|
||||
|
||||
// Generic overloads with constraints called without type arguments but with types that do not satisfy the constraints
|
||||
new fn4(true, null); // Error
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~
|
||||
!!! Argument of type 'boolean' is not assignable to parameter of type 'number'.
|
||||
new fn4(null, true); // Error
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~
|
||||
!!! Argument of type 'boolean' is not assignable to parameter of type 'string'.
|
||||
|
||||
// Non - generic overloads where contextual typing of function arguments has errors
|
||||
interface fn5 {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
==== tests/cases/compiler/overloadResolutionOverCTLambda.ts (1 errors) ====
|
||||
function foo(b: (item: number) => boolean) { }
|
||||
foo(a => a); // can not convert (number)=>bool to (number)=>number
|
||||
~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~
|
||||
!!! Argument of type '(a: number) => number' is not assignable to parameter of type '(item: number) => boolean'.
|
||||
@ -7,8 +7,11 @@
|
||||
var x1 = foo([{a:true}]); // works
|
||||
var x11 = foo([{a:0}]); // works
|
||||
var x111 = foo([{a:"s"}]); // error - does not match any signature
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~
|
||||
!!! Argument of type '{ a: string; }[]' is not assignable to parameter of type '{ a: boolean; }[]'.
|
||||
!!! Type '{ a: string; }' is not assignable to type '{ a: boolean; }':
|
||||
!!! Types of property 'a' are incompatible:
|
||||
!!! Type 'string' is not assignable to type 'boolean'.
|
||||
var x1111 = foo([{a:null}]); // works - ambiguous call is resolved to be the first in the overload set so this returns a string
|
||||
|
||||
|
||||
@ -20,13 +23,17 @@
|
||||
var x2 = foo2({a:0}); // works
|
||||
var x3 = foo2({a:true}); // works
|
||||
var x4 = foo2({a:"s"}); // error
|
||||
~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~
|
||||
!!! Argument of type '{ a: string; }' is not assignable to parameter of type '{ a: boolean; }'.
|
||||
!!! Types of property 'a' are incompatible:
|
||||
!!! Type 'string' is not assignable to type 'boolean'.
|
||||
|
||||
|
||||
function foo4(bar:{a:number;}):number;
|
||||
function foo4(bar:{a:string;}):string;
|
||||
function foo4(bar:{a:any;}):any{ return bar };
|
||||
var x = foo4({a:true}); // error
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~
|
||||
!!! Argument of type '{ a: boolean; }' is not assignable to parameter of type '{ a: string; }'.
|
||||
!!! Types of property 'a' are incompatible:
|
||||
!!! Type 'boolean' is not assignable to type 'string'.
|
||||
@ -18,8 +18,8 @@
|
||||
var a: D = foo("hi", []); // D
|
||||
var b: E = foo("bye", []); // E
|
||||
var c = foo("um", []); // error
|
||||
~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~
|
||||
!!! Argument of type 'string' is not assignable to parameter of type '"bye"'.
|
||||
|
||||
|
||||
//function bar(x: "hi", items: string[]): D;
|
||||
|
||||
@ -15,17 +15,17 @@
|
||||
var result: number = foo(x => new G(x)); // No error, returns number
|
||||
~~~~~~
|
||||
!!! Type 'string' is not assignable to type 'number'.
|
||||
~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'D' is not assignable to parameter of type 'A'.
|
||||
|
||||
var result2: number = foo(x => new G<typeof x>(x)); // No error, returns number
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: D) => G<D>' is not assignable to parameter of type '(x: B) => any'.
|
||||
~~~~~~~~
|
||||
!!! Type 'D' does not satisfy the constraint 'A'.
|
||||
|
||||
var result3: string = foo(x => { // returns string because the C overload is picked
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
var y: G<typeof x>; // error that C does not satisfy constraint
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~
|
||||
@ -33,6 +33,6 @@
|
||||
return y;
|
||||
~~~~~~~~~~~~~
|
||||
});
|
||||
~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type '(x: D) => G<D>' is not assignable to parameter of type '(x: B) => any'.
|
||||
|
||||
@ -5,13 +5,13 @@
|
||||
};
|
||||
|
||||
func(s => ({})); // Error for no applicable overload (object type is missing a and b)
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~
|
||||
!!! Argument of type '(s: string) => {}' is not assignable to parameter of type '(s: string) => { a: number; b: number; }'.
|
||||
func(s => ({ a: blah, b: 3 })); // Only error inside the function, but not outside (since it would be applicable if not for the provisional error)
|
||||
~~~~
|
||||
!!! Cannot find name 'blah'.
|
||||
func(s => ({ a: blah })); // Two errors here, one for blah not being defined, and one for the overload since it would not be applicable anyway
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
!!! Argument of type '(s: string) => { a: unknown; }' is not assignable to parameter of type '(s: string) => { a: number; b: number; }'.
|
||||
~~~~
|
||||
!!! Cannot find name 'blah'.
|
||||
@ -6,9 +6,9 @@
|
||||
var x = () => g;
|
||||
foo(g);
|
||||
foo(() => g);
|
||||
~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~
|
||||
!!! Argument of type '() => (x: string) => string' is not assignable to parameter of type '(x: string) => string'.
|
||||
foo(x);
|
||||
~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type '() => (x: string) => string' is not assignable to parameter of type '(x: string) => string'.
|
||||
|
||||
@ -12,5 +12,5 @@
|
||||
static();
|
||||
~~~~~~
|
||||
!!! Declaration or statement expected.
|
||||
~
|
||||
!!! '=>' expected.
|
||||
~
|
||||
!!! Expression expected.
|
||||
@ -7,8 +7,8 @@
|
||||
|
||||
var x = new C<number>();
|
||||
x.bar2(2, ""); // should error
|
||||
~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~
|
||||
!!! Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
x.bar2<string>(2, ""); // should error
|
||||
~~~~~~
|
||||
!!! Type 'string' does not satisfy the constraint 'number'.
|
||||
@ -6,8 +6,8 @@
|
||||
var result = cb(this.value);
|
||||
// should get a fresh type parameter which each then call
|
||||
var z = this.then(x => result)/*S*/.then(x => "abc")/*Function*/.then(x => x.length)/*number*/; // Should error on "abc" because it is not a Function
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~
|
||||
!!! Argument of type '(x: S) => string' is not assignable to parameter of type '(x: S) => Function'.
|
||||
return new Chain2(result);
|
||||
}
|
||||
}
|
||||
@ -6,8 +6,8 @@
|
||||
var result = cb(this.value);
|
||||
// should get a fresh type parameter which each then call
|
||||
var z = this.then(x => result).then(x => "abc").then(x => x.length);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~
|
||||
!!! Argument of type '(x: S) => string' is not assignable to parameter of type '(x: S) => Function'.
|
||||
return new Chain2(result);
|
||||
}
|
||||
}
|
||||
@ -78,109 +78,109 @@
|
||||
var sIPromise: (x: any) => IPromise<string>;
|
||||
var sPromise: (x: any) => Promise<string>;
|
||||
var r4a = r4.then(testFunction4, testFunction4, testFunction4); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: number, y?: string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
var r4b = r4.then(sIPromise, testFunction4, testFunction4).then(sIPromise, testFunction4, testFunction4); // ok
|
||||
var s4: Promise<string>;
|
||||
var s4a = s4.then(testFunction4, testFunction4, testFunction4); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: number, y?: string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
var s4b = s4.then(testFunction4P, testFunction4P, testFunction4P); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: number, y?: string) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
|
||||
var s4c = s4.then(testFunction4P, testFunction4, testFunction4); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: number, y?: string) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
var s4d = s4.then(sIPromise, testFunction4P, testFunction4).then(sIPromise, testFunction4P, testFunction4);
|
||||
|
||||
var r5: IPromise<string>;
|
||||
var r5a = r5.then(testFunction5, testFunction5, testFunction5); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: number, cb: (a: string) => string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
var r5b = r5.then(sIPromise, sIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok
|
||||
var s5: Promise<string>;
|
||||
var s5a = s5.then(testFunction5, testFunction5, testFunction5); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: number, cb: (a: string) => string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
var s5b = s5.then(testFunction5P, testFunction5P, testFunction5P); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: number, cb: (a: string) => string) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
|
||||
var s5c = s5.then(testFunction5P, testFunction5, testFunction5); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: number, cb: (a: string) => string) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
var s5d = s5.then(sPromise, sPromise, sPromise).then(sIPromise, sIPromise, sIPromise); // ok
|
||||
|
||||
var r6: IPromise<string>;
|
||||
var r6a = r6.then(testFunction6, testFunction6, testFunction6); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: number, cb: <T>(a: T) => T) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
var r6b = r6.then(sIPromise, sIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok
|
||||
var s6: Promise<string>;
|
||||
var s6a = s6.then(testFunction6, testFunction6, testFunction6); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: number, cb: <T>(a: T) => T) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
var s6b = s6.then(testFunction6P, testFunction6P, testFunction6P); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: number, cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
|
||||
var s6c = s6.then(testFunction6P, testFunction6, testFunction6); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: number, cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
var s6d = s6.then(sPromise, sPromise, sPromise).then(sIPromise, sIPromise, sIPromise); // ok
|
||||
|
||||
var r7: IPromise<string>;
|
||||
var r7a = r7.then(testFunction7, testFunction7, testFunction7); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~
|
||||
!!! Argument of type '(cb: <T>(a: T) => T) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
var r7b = r7.then(sIPromise, sIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok
|
||||
var s7: Promise<string>;
|
||||
var s7a = r7.then(testFunction7, testFunction7, testFunction7); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~
|
||||
!!! Argument of type '(cb: <T>(a: T) => T) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
var s7b = r7.then(testFunction7P, testFunction7P, testFunction7P); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '(cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
|
||||
var s7c = r7.then(testFunction7P, testFunction7, testFunction7); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '(cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
var s7d = r7.then(sPromise, sPromise, sPromise).then(sPromise, sPromise, sPromise); // ok?
|
||||
|
||||
var r8: IPromise<number>;
|
||||
var nIPromise: (x: any) => IPromise<number>;
|
||||
var nPromise: (x: any) => Promise<number>;
|
||||
var r8a = r8.then(testFunction8, testFunction8, testFunction8); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~
|
||||
!!! Argument of type '<T>(x: T, cb: (a: T) => T) => IPromise<T>' is not assignable to parameter of type '(value: number) => IPromise<number>'.
|
||||
var r8b = r8.then(nIPromise, nIPromise, nIPromise).then(nIPromise, nIPromise, nIPromise); // ok
|
||||
var s8: Promise<number>;
|
||||
var s8a = s8.then(testFunction8, testFunction8, testFunction8); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~
|
||||
!!! Argument of type '<T>(x: T, cb: (a: T) => T) => IPromise<T>' is not assignable to parameter of type '(value: number) => IPromise<number>'.
|
||||
var s8b = s8.then(testFunction8P, testFunction8P, testFunction8P); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '<T>(x: T, cb: (a: T) => T) => Promise<T>' is not assignable to parameter of type '(value: number) => Promise<number>'.
|
||||
var s8c = s8.then(testFunction8P, testFunction8, testFunction8); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '<T>(x: T, cb: (a: T) => T) => Promise<T>' is not assignable to parameter of type '(value: number) => IPromise<any>'.
|
||||
var s8d = s8.then(nIPromise, nIPromise, nIPromise).then(nIPromise, nIPromise, nIPromise); // ok
|
||||
|
||||
var r9: IPromise<number>;
|
||||
var r9a = r9.then(testFunction9, testFunction9, testFunction9); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~
|
||||
!!! Argument of type '<T>(x: T, cb: <U>(a: U) => U) => IPromise<T>' is not assignable to parameter of type '(value: number) => IPromise<number>'.
|
||||
var r9b = r9.then(sIPromise, sIPromise, sIPromise); // ok
|
||||
var r9c = r9.then(nIPromise, nIPromise, nIPromise); // ok
|
||||
var r9d = r9.then(testFunction, sIPromise, nIPromise); // ok
|
||||
var r9e = r9.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok
|
||||
var s9: Promise<number>;
|
||||
var s9a = s9.then(testFunction9, testFunction9, testFunction9); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~
|
||||
!!! Argument of type '<T>(x: T, cb: <U>(a: U) => U) => IPromise<T>' is not assignable to parameter of type '(value: number) => IPromise<number>'.
|
||||
var s9b = s9.then(testFunction9P, testFunction9P, testFunction9P); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '<T>(x: T, cb: <U>(a: U) => U) => Promise<T>' is not assignable to parameter of type '(value: number) => Promise<number>'.
|
||||
var s9c = s9.then(testFunction9P, testFunction9, testFunction9); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '<T>(x: T, cb: <U>(a: U) => U) => Promise<T>' is not assignable to parameter of type '(value: number) => IPromise<any>'.
|
||||
var s9d = s9.then(sPromise, sPromise, sPromise); // ok
|
||||
var s9e = s9.then(nPromise, nPromise, nPromise); // ok
|
||||
var s9f = s9.then(testFunction, sIPromise, nIPromise); // ok
|
||||
@ -205,8 +205,8 @@
|
||||
var r11a = r11.then(testFunction11, testFunction11, testFunction11); // ok
|
||||
var s11: Promise<number>;
|
||||
var s11a = s11.then(testFunction11, testFunction11, testFunction11); // ok
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '{ (x: number): IPromise<number>; (x: string): IPromise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
|
||||
var s11b = s11.then(testFunction11P, testFunction11P, testFunction11P); // ok
|
||||
var s11c = s11.then(testFunction11P, testFunction11, testFunction11); // ok
|
||||
|
||||
|
||||
@ -72,116 +72,116 @@
|
||||
var s3b = s3.then(testFunction3P, testFunction3P, testFunction3P);
|
||||
var s3c = s3.then(testFunction3P, testFunction3, testFunction3);
|
||||
var s3d = s3.then(testFunction3P, testFunction3, testFunction3).then(testFunction3, testFunction3, testFunction3); // Should error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: number) => IPromise<number>' is not assignable to parameter of type '(value: IPromise<number>) => IPromise<number>'.
|
||||
|
||||
var r4: IPromise<string>;
|
||||
var sIPromise: (x: any) => IPromise<string>;
|
||||
var sPromise: (x: any) => Promise<string>;
|
||||
var r4a = r4.then(testFunction4, testFunction4, testFunction4); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: number, y?: string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
var r4b = r4.then(sIPromise, testFunction4, testFunction4).then(sIPromise, testFunction4, testFunction4); // ok
|
||||
var s4: Promise<string>;
|
||||
var s4a = s4.then(testFunction4, testFunction4, testFunction4); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: number, y?: string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
var s4b = s4.then(testFunction4P, testFunction4P, testFunction4P); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: number, y?: string) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
|
||||
var s4c = s4.then(testFunction4P, testFunction4, testFunction4); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: number, y?: string) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
var s4d = s4.then(sIPromise, testFunction4P, testFunction4).then(sIPromise, testFunction4P, testFunction4);
|
||||
|
||||
var r5: IPromise<string>;
|
||||
var r5a = r5.then(testFunction5, testFunction5, testFunction5); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: number, cb: (a: string) => string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
var r5b = r5.then(sIPromise, sIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok
|
||||
var s5: Promise<string>;
|
||||
var s5a = s5.then(testFunction5, testFunction5, testFunction5); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: number, cb: (a: string) => string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
var s5b = s5.then(testFunction5P, testFunction5P, testFunction5P); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: number, cb: (a: string) => string) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
|
||||
var s5c = s5.then(testFunction5P, testFunction5, testFunction5); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: number, cb: (a: string) => string) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
var s5d = s5.then(sPromise, sPromise, sPromise).then(sIPromise, sIPromise, sIPromise); // ok
|
||||
|
||||
var r6: IPromise<string>;
|
||||
var r6a = r6.then(testFunction6, testFunction6, testFunction6); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: number, cb: <T>(a: T) => T) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
var r6b = r6.then(sIPromise, sIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok
|
||||
var s6: Promise<string>;
|
||||
var s6a = s6.then(testFunction6, testFunction6, testFunction6); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: number, cb: <T>(a: T) => T) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
var s6b = s6.then(testFunction6P, testFunction6P, testFunction6P); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: number, cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
|
||||
var s6c = s6.then(testFunction6P, testFunction6, testFunction6); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: number, cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
var s6d = s6.then(sPromise, sPromise, sPromise).then(sIPromise, sIPromise, sIPromise); // ok
|
||||
|
||||
var r7: IPromise<string>;
|
||||
var r7a = r7.then(testFunction7, testFunction7, testFunction7); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~
|
||||
!!! Argument of type '(cb: <T>(a: T) => T) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
var r7b = r7.then(sIPromise, sIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok
|
||||
var s7: Promise<string>;
|
||||
var s7a = r7.then(testFunction7, testFunction7, testFunction7); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~
|
||||
!!! Argument of type '(cb: <T>(a: T) => T) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
var s7b = r7.then(testFunction7P, testFunction7P, testFunction7P); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '(cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
|
||||
var s7c = r7.then(testFunction7P, testFunction7, testFunction7); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '(cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
var s7d = r7.then(sPromise, sPromise, sPromise).then(sPromise, sPromise, sPromise); // ok?
|
||||
|
||||
var r8: IPromise<number>;
|
||||
var nIPromise: (x: any) => IPromise<number>;
|
||||
var nPromise: (x: any) => Promise<number>;
|
||||
var r8a = r8.then(testFunction8, testFunction8, testFunction8); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~
|
||||
!!! Argument of type '<T>(x: T, cb: (a: T) => T) => IPromise<T>' is not assignable to parameter of type '(value: number) => IPromise<number>'.
|
||||
var r8b = r8.then(nIPromise, nIPromise, nIPromise).then(nIPromise, nIPromise, nIPromise); // ok
|
||||
var s8: Promise<number>;
|
||||
var s8a = s8.then(testFunction8, testFunction8, testFunction8); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~
|
||||
!!! Argument of type '<T>(x: T, cb: (a: T) => T) => IPromise<T>' is not assignable to parameter of type '(value: number) => IPromise<number>'.
|
||||
var s8b = s8.then(testFunction8P, testFunction8P, testFunction8P); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '<T>(x: T, cb: (a: T) => T) => Promise<T>' is not assignable to parameter of type '(value: number) => Promise<number>'.
|
||||
var s8c = s8.then(testFunction8P, testFunction8, testFunction8); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '<T>(x: T, cb: (a: T) => T) => Promise<T>' is not assignable to parameter of type '(value: number) => IPromise<any>'.
|
||||
var s8d = s8.then(nIPromise, nIPromise, nIPromise).then(nIPromise, nIPromise, nIPromise); // ok
|
||||
|
||||
var r9: IPromise<number>;
|
||||
var r9a = r9.then(testFunction9, testFunction9, testFunction9); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~
|
||||
!!! Argument of type '<T>(x: T, cb: <U>(a: U) => U) => IPromise<T>' is not assignable to parameter of type '(value: number) => IPromise<number>'.
|
||||
var r9b = r9.then(sIPromise, sIPromise, sIPromise); // ok
|
||||
var r9c = r9.then(nIPromise, nIPromise, nIPromise); // ok
|
||||
var r9d = r9.then(testFunction, sIPromise, nIPromise); // ok
|
||||
var r9e = r9.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok
|
||||
var s9: Promise<number>;
|
||||
var s9a = s9.then(testFunction9, testFunction9, testFunction9); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~
|
||||
!!! Argument of type '<T>(x: T, cb: <U>(a: U) => U) => IPromise<T>' is not assignable to parameter of type '(value: number) => IPromise<number>'.
|
||||
var s9b = s9.then(testFunction9P, testFunction9P, testFunction9P); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '<T>(x: T, cb: <U>(a: U) => U) => Promise<T>' is not assignable to parameter of type '(value: number) => Promise<number>'.
|
||||
var s9c = s9.then(testFunction9P, testFunction9, testFunction9); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '<T>(x: T, cb: <U>(a: U) => U) => Promise<T>' is not assignable to parameter of type '(value: number) => IPromise<any>'.
|
||||
var s9d = s9.then(sPromise, sPromise, sPromise); // ok
|
||||
var s9e = s9.then(nPromise, nPromise, nPromise); // ok
|
||||
var s9f = s9.then(testFunction, sIPromise, nIPromise); // ok
|
||||
@ -206,14 +206,14 @@
|
||||
var r11a = r11.then(testFunction11, testFunction11, testFunction11); // ok
|
||||
var s11: Promise<number>;
|
||||
var s11a = s11.then(testFunction11, testFunction11, testFunction11); // ok
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '{ (x: number): IPromise<number>; (x: string): IPromise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
|
||||
var s11b = s11.then(testFunction11P, testFunction11P, testFunction11P); // ok
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Argument of type '{ (x: number): Promise<number>; (x: string): Promise<string>; }' is not assignable to parameter of type '(value: number) => Promise<string>'.
|
||||
var s11c = s11.then(testFunction11P, testFunction11, testFunction11); // ok
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Argument of type '{ (x: number): Promise<number>; (x: string): Promise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
|
||||
|
||||
var r12 = testFunction12(x => x);
|
||||
var r12a = r12.then(testFunction12, testFunction12, testFunction12); // ok
|
||||
|
||||
@ -67,8 +67,8 @@
|
||||
var r3: IPromise<number>;
|
||||
var r3a = r3.then(testFunction3, testFunction3, testFunction3);
|
||||
var r3b = r3.then(testFunction3, testFunction3, testFunction3).then(testFunction3, testFunction3, testFunction3);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: number) => IPromise<number>' is not assignable to parameter of type '(value: IPromise<number>) => IPromise<number>'.
|
||||
var s3: Promise<number>;
|
||||
var s3a = s3.then(testFunction3, testFunction3, testFunction3);
|
||||
var s3b = s3.then(testFunction3P, testFunction3P, testFunction3P);
|
||||
@ -79,109 +79,109 @@
|
||||
var sIPromise: (x: any) => IPromise<string>;
|
||||
var sPromise: (x: any) => Promise<string>;
|
||||
var r4a = r4.then(testFunction4, testFunction4, testFunction4); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: number, y?: string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
var r4b = r4.then(sIPromise, testFunction4, testFunction4).then(sIPromise, testFunction4, testFunction4); // ok
|
||||
var s4: Promise<string>;
|
||||
var s4a = s4.then(testFunction4, testFunction4, testFunction4); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: number, y?: string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
var s4b = s4.then(testFunction4P, testFunction4P, testFunction4P); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: number, y?: string) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
|
||||
var s4c = s4.then(testFunction4P, testFunction4, testFunction4); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: number, y?: string) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
var s4d = s4.then(sIPromise, testFunction4P, testFunction4).then(sIPromise, testFunction4P, testFunction4);
|
||||
|
||||
var r5: IPromise<string>;
|
||||
var r5a = r5.then(testFunction5, testFunction5, testFunction5); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: number, cb: (a: string) => string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
var r5b = r5.then(sIPromise, sIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok
|
||||
var s5: Promise<string>;
|
||||
var s5a = s5.then(testFunction5, testFunction5, testFunction5); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: number, cb: (a: string) => string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
var s5b = s5.then(testFunction5P, testFunction5P, testFunction5P); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: number, cb: (a: string) => string) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
|
||||
var s5c = s5.then(testFunction5P, testFunction5, testFunction5); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: number, cb: (a: string) => string) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
var s5d = s5.then(sPromise, sPromise, sPromise).then(sIPromise, sIPromise, sIPromise); // ok
|
||||
|
||||
var r6: IPromise<string>;
|
||||
var r6a = r6.then(testFunction6, testFunction6, testFunction6); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: number, cb: <T>(a: T) => T) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
var r6b = r6.then(sIPromise, sIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok
|
||||
var s6: Promise<string>;
|
||||
var s6a = s6.then(testFunction6, testFunction6, testFunction6); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: number, cb: <T>(a: T) => T) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
var s6b = s6.then(testFunction6P, testFunction6P, testFunction6P); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: number, cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
|
||||
var s6c = s6.then(testFunction6P, testFunction6, testFunction6); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: number, cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
var s6d = s6.then(sPromise, sPromise, sPromise).then(sIPromise, sIPromise, sIPromise); // ok
|
||||
|
||||
var r7: IPromise<string>;
|
||||
var r7a = r7.then(testFunction7, testFunction7, testFunction7); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~
|
||||
!!! Argument of type '(cb: <T>(a: T) => T) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
var r7b = r7.then(sIPromise, sIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok
|
||||
var s7: Promise<string>;
|
||||
var s7a = r7.then(testFunction7, testFunction7, testFunction7); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~
|
||||
!!! Argument of type '(cb: <T>(a: T) => T) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
var s7b = r7.then(testFunction7P, testFunction7P, testFunction7P); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '(cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
|
||||
var s7c = r7.then(testFunction7P, testFunction7, testFunction7); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '(cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
|
||||
var s7d = r7.then(sPromise, sPromise, sPromise).then(sPromise, sPromise, sPromise); // ok?
|
||||
|
||||
var r8: IPromise<number>;
|
||||
var nIPromise: (x: any) => IPromise<number>;
|
||||
var nPromise: (x: any) => Promise<number>;
|
||||
var r8a = r8.then(testFunction8, testFunction8, testFunction8); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~
|
||||
!!! Argument of type '<T>(x: T, cb: (a: T) => T) => IPromise<T>' is not assignable to parameter of type '(value: number) => IPromise<number>'.
|
||||
var r8b = r8.then(nIPromise, nIPromise, nIPromise).then(nIPromise, nIPromise, nIPromise); // ok
|
||||
var s8: Promise<number>;
|
||||
var s8a = s8.then(testFunction8, testFunction8, testFunction8); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~
|
||||
!!! Argument of type '<T>(x: T, cb: (a: T) => T) => IPromise<T>' is not assignable to parameter of type '(value: number) => IPromise<number>'.
|
||||
var s8b = s8.then(testFunction8P, testFunction8P, testFunction8P); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '<T>(x: T, cb: (a: T) => T) => Promise<T>' is not assignable to parameter of type '(value: number) => Promise<number>'.
|
||||
var s8c = s8.then(testFunction8P, testFunction8, testFunction8); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '<T>(x: T, cb: (a: T) => T) => Promise<T>' is not assignable to parameter of type '(value: number) => IPromise<any>'.
|
||||
var s8d = s8.then(nIPromise, nIPromise, nIPromise).then(nIPromise, nIPromise, nIPromise); // ok
|
||||
|
||||
var r9: IPromise<number>;
|
||||
var r9a = r9.then(testFunction9, testFunction9, testFunction9); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~
|
||||
!!! Argument of type '<T>(x: T, cb: <U>(a: U) => U) => IPromise<T>' is not assignable to parameter of type '(value: number) => IPromise<number>'.
|
||||
var r9b = r9.then(sIPromise, sIPromise, sIPromise); // ok
|
||||
var r9c = r9.then(nIPromise, nIPromise, nIPromise); // ok
|
||||
var r9d = r9.then(testFunction, sIPromise, nIPromise); // ok
|
||||
var r9e = r9.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok
|
||||
var s9: Promise<number>;
|
||||
var s9a = s9.then(testFunction9, testFunction9, testFunction9); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~
|
||||
!!! Argument of type '<T>(x: T, cb: <U>(a: U) => U) => IPromise<T>' is not assignable to parameter of type '(value: number) => IPromise<number>'.
|
||||
var s9b = s9.then(testFunction9P, testFunction9P, testFunction9P); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '<T>(x: T, cb: <U>(a: U) => U) => Promise<T>' is not assignable to parameter of type '(value: number) => Promise<number>'.
|
||||
var s9c = s9.then(testFunction9P, testFunction9, testFunction9); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '<T>(x: T, cb: <U>(a: U) => U) => Promise<T>' is not assignable to parameter of type '(value: number) => IPromise<any>'.
|
||||
var s9d = s9.then(sPromise, sPromise, sPromise); // ok
|
||||
var s9e = s9.then(nPromise, nPromise, nPromise); // ok
|
||||
var s9f = s9.then(testFunction, sIPromise, nIPromise); // ok
|
||||
@ -204,12 +204,12 @@
|
||||
|
||||
var r11: IPromise<number>;
|
||||
var r11a = r11.then(testFunction11, testFunction11, testFunction11); // ok
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '{ (x: number): IPromise<number>; (x: string): IPromise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
|
||||
var s11: Promise<number>;
|
||||
var s11a = s11.then(testFunction11, testFunction11, testFunction11); // ok
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Argument of type '{ (x: number): IPromise<number>; (x: string): IPromise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
|
||||
var s11b = s11.then(testFunction11P, testFunction11P, testFunction11P); // ok
|
||||
var s11c = s11.then(testFunction11P, testFunction11, testFunction11); // ok
|
||||
|
||||
@ -218,6 +218,6 @@
|
||||
var s12 = testFunction12(x => x);
|
||||
var s12a = s12.then(testFunction12, testFunction12, testFunction12); // ok
|
||||
var s12b = s12.then(testFunction12P, testFunction12P, testFunction12P); // ok
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Argument of type '{ <T>(x: T): IPromise<T>; <T>(x: T, y: T): Promise<T>; }' is not assignable to parameter of type '(value: (x: any) => any) => Promise<any>'.
|
||||
var s12c = s12.then(testFunction12P, testFunction12, testFunction12); // ok
|
||||
@ -100,8 +100,8 @@
|
||||
// scenario 2
|
||||
public getInitialState(): IState {
|
||||
return new State(self);
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~
|
||||
!!! Argument of type 'Window' is not assignable to parameter of type 'IMode'.
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -34,8 +34,8 @@
|
||||
static g(t: typeof C.g){ }
|
||||
}
|
||||
C.g(3); // error
|
||||
~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type '(t: typeof g) => void'.
|
||||
|
||||
var f4: () => typeof f4;
|
||||
f4 = 3; // error
|
||||
@ -52,8 +52,8 @@
|
||||
~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
f6(""); // ok (function takes an any param)
|
||||
~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~
|
||||
!!! Argument of type 'string' is not assignable to parameter of type '{ (): typeof f6; (a: typeof f6): () => number; }'.
|
||||
f6(); // ok
|
||||
|
||||
declare function f7(): typeof f7;
|
||||
@ -65,6 +65,6 @@
|
||||
~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
f7(""); // ok (function takes an any param)
|
||||
~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~
|
||||
!!! Argument of type 'string' is not assignable to parameter of type '{ (): typeof f7; (a: typeof f7): () => number; (a: number): number; (a?: typeof f7): typeof f7; }'.
|
||||
f7(); // ok
|
||||
@ -6,10 +6,10 @@
|
||||
}
|
||||
// both are errors
|
||||
x3(1, (x: string) => 1);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
x3(1, (x: 'hm') => 1);
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! A signature with an implementation cannot use a string literal type.
|
||||
@ -1,5 +1,5 @@
|
||||
==== tests/cases/conformance/types/primitives/string/stringPropertyAccessWithError.ts (1 errors) ====
|
||||
var x = '';
|
||||
var d = x['charAt']('invalid'); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~
|
||||
!!! Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
@ -1,5 +1,5 @@
|
||||
==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesA.ts (1 errors) ====
|
||||
declare function foo3(cb: (x: number) => number): typeof cb;
|
||||
var r5 = foo3((x: number) => ''); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: number) => string' is not assignable to parameter of type '(x: number) => number'.
|
||||
@ -4,11 +4,13 @@
|
||||
callTest() {
|
||||
// these two should give the same error
|
||||
this.test([1, 2, "hi", 5, ]);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! Argument of type '{}[]' is not assignable to parameter of type 'number[]'.
|
||||
!!! Type '{}' is not assignable to type 'number'.
|
||||
this.test([1, 2, "hi", 5]);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Argument of type '{}[]' is not assignable to parameter of type 'number[]'.
|
||||
!!! Type '{}' is not assignable to type 'number'.
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,5 +6,5 @@
|
||||
declare function foo<T extends Item>(x?: T, y?: T): T;
|
||||
|
||||
var z7 = foo("abc", 5); // Error
|
||||
~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~
|
||||
!!! Argument of type 'string' is not assignable to parameter of type 'Item'.
|
||||
@ -24,8 +24,8 @@
|
||||
var someGenerics1: someGenerics1;
|
||||
new someGenerics1(3, 4);
|
||||
new someGenerics1<string, number>(3, 4); // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~
|
||||
!!! Argument of type 'number' is not assignable to parameter of type 'string'.
|
||||
new someGenerics1<number, {}>(3, 4);
|
||||
|
||||
// Generic call with argument of function type whose parameter is of type parameter type
|
||||
@ -64,8 +64,8 @@
|
||||
new someGenerics4(4, () => null);
|
||||
new someGenerics4<string, number>('', () => 3);
|
||||
new someGenerics4<string, number>('', (x: string) => ''); // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'.
|
||||
new someGenerics4<string, number>(null, null);
|
||||
|
||||
// 2 parameter generic call with argument 2 of type parameter type and argument 1 of function type whose parameter is of type parameter type
|
||||
@ -76,8 +76,8 @@
|
||||
new someGenerics5(4, () => null);
|
||||
new someGenerics5<number, string>('', () => 3);
|
||||
new someGenerics5<number, string>('', (x: string) => ''); // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'.
|
||||
new someGenerics5<string, number>(null, null);
|
||||
|
||||
// Generic call with multiple arguments of function types that each have parameters of the same generic type
|
||||
@ -88,8 +88,8 @@
|
||||
new someGenerics6(n => n, n => n, n => n);
|
||||
new someGenerics6<number>(n => n, n => n, n => n);
|
||||
new someGenerics6<number>((n: number) => n, (n: string) => n, (n: number) => n); // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Supplied parameters do not match any signature of call target.
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! Argument of type '(n: string) => string' is not assignable to parameter of type '(b: number) => number'.
|
||||
new someGenerics6<number>((n: number) => n, (n: number) => n, (n: number) => n);
|
||||
|
||||
// Generic call with multiple arguments of function types that each have parameters of different generic type
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user