diff --git a/tests/baselines/reference/strictBindCallApply1.errors.txt b/tests/baselines/reference/strictBindCallApply1.errors.txt new file mode 100644 index 00000000000..e998238a8f7 --- /dev/null +++ b/tests/baselines/reference/strictBindCallApply1.errors.txt @@ -0,0 +1,139 @@ +tests/cases/conformance/functions/strictBindCallApply1.ts(6,35): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. +tests/cases/conformance/functions/strictBindCallApply1.ts(9,11): error TS2554: Expected 3 arguments, but got 2. +tests/cases/conformance/functions/strictBindCallApply1.ts(10,35): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. +tests/cases/conformance/functions/strictBindCallApply1.ts(11,11): error TS2554: Expected 3 arguments, but got 4. +tests/cases/conformance/functions/strictBindCallApply1.ts(14,32): error TS2345: Argument of type '[number]' is not assignable to parameter of type '[number, string]'. + Property '1' is missing in type '[number]'. +tests/cases/conformance/functions/strictBindCallApply1.ts(15,37): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/functions/strictBindCallApply1.ts(16,32): error TS2345: Argument of type '[number, string, number]' is not assignable to parameter of type '[number, string]'. + Types of property 'length' are incompatible. + Type '3' is not assignable to type '2'. +tests/cases/conformance/functions/strictBindCallApply1.ts(29,29): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. +tests/cases/conformance/functions/strictBindCallApply1.ts(30,22): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'C'. +tests/cases/conformance/functions/strictBindCallApply1.ts(33,11): error TS2554: Expected 3 arguments, but got 2. +tests/cases/conformance/functions/strictBindCallApply1.ts(34,29): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. +tests/cases/conformance/functions/strictBindCallApply1.ts(35,11): error TS2554: Expected 3 arguments, but got 4. +tests/cases/conformance/functions/strictBindCallApply1.ts(36,22): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'C'. +tests/cases/conformance/functions/strictBindCallApply1.ts(39,26): error TS2345: Argument of type '[number]' is not assignable to parameter of type '[number, string]'. +tests/cases/conformance/functions/strictBindCallApply1.ts(40,31): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/functions/strictBindCallApply1.ts(41,26): error TS2345: Argument of type '[number, string, number]' is not assignable to parameter of type '[number, string]'. +tests/cases/conformance/functions/strictBindCallApply1.ts(42,23): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'C'. +tests/cases/conformance/functions/strictBindCallApply1.ts(47,33): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. +tests/cases/conformance/functions/strictBindCallApply1.ts(50,1): error TS2554: Expected 3 arguments, but got 2. +tests/cases/conformance/functions/strictBindCallApply1.ts(51,15): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. +tests/cases/conformance/functions/strictBindCallApply1.ts(52,1): error TS2554: Expected 3 arguments, but got 4. +tests/cases/conformance/functions/strictBindCallApply1.ts(55,12): error TS2345: Argument of type '[number]' is not assignable to parameter of type '[number, string]'. +tests/cases/conformance/functions/strictBindCallApply1.ts(56,17): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/functions/strictBindCallApply1.ts(57,12): error TS2345: Argument of type '[number, string, number]' is not assignable to parameter of type '[number, string]'. + + +==== tests/cases/conformance/functions/strictBindCallApply1.ts (24 errors) ==== + declare function foo(a: number, b: string): string; + + let f00 = foo.bind(undefined); + let f01 = foo.bind(undefined, 10); + let f02 = foo.bind(undefined, 10, "hello"); + let f03 = foo.bind(undefined, 10, 20); // Error + ~~ +!!! error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. + + let c00 = foo.call(undefined, 10, "hello"); + let c01 = foo.call(undefined, 10); // Error + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2554: Expected 3 arguments, but got 2. + let c02 = foo.call(undefined, 10, 20); // Error + ~~ +!!! error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. + let c03 = foo.call(undefined, 10, "hello", 30); // Error + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2554: Expected 3 arguments, but got 4. + + let a00 = foo.apply(undefined, [10, "hello"]); + let a01 = foo.apply(undefined, [10]); // Error + ~~~~ +!!! error TS2345: Argument of type '[number]' is not assignable to parameter of type '[number, string]'. +!!! error TS2345: Property '1' is missing in type '[number]'. + let a02 = foo.apply(undefined, [10, 20]); // Error + ~~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. + let a03 = foo.apply(undefined, [10, "hello", 30]); // Error + ~~~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '[number, string, number]' is not assignable to parameter of type '[number, string]'. +!!! error TS2345: Types of property 'length' are incompatible. +!!! error TS2345: Type '3' is not assignable to type '2'. + + class C { + constructor(a: number, b: string) {} + foo(this: this, a: number, b: string): string { return "" } + } + + declare let c: C; + declare let obj: {}; + + let f10 = c.foo.bind(c); + let f11 = c.foo.bind(c, 10); + let f12 = c.foo.bind(c, 10, "hello"); + let f13 = c.foo.bind(c, 10, 20); // Error + ~~ +!!! error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. + let f14 = c.foo.bind(undefined); // Error + ~~~~~~~~~ +!!! error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'C'. + + let c10 = c.foo.call(c, 10, "hello"); + let c11 = c.foo.call(c, 10); // Error + ~~~~~~~~~~~~~~~~~ +!!! error TS2554: Expected 3 arguments, but got 2. + let c12 = c.foo.call(c, 10, 20); // Error + ~~ +!!! error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. + let c13 = c.foo.call(c, 10, "hello", 30); // Error + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2554: Expected 3 arguments, but got 4. + let c14 = c.foo.call(undefined, 10, "hello"); // Error + ~~~~~~~~~ +!!! error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'C'. + + let a10 = c.foo.apply(c, [10, "hello"]); + let a11 = c.foo.apply(c, [10]); // Error + ~~~~ +!!! error TS2345: Argument of type '[number]' is not assignable to parameter of type '[number, string]'. + let a12 = c.foo.apply(c, [10, 20]); // Error + ~~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. + let a13 = c.foo.apply(c, [10, "hello", 30]); // Error + ~~~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '[number, string, number]' is not assignable to parameter of type '[number, string]'. + let a14 = c.foo.apply(undefined, [10, "hello"]); // Error + ~~~~~~~~~ +!!! error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'C'. + + let f20 = C.bind(undefined); + let f21 = C.bind(undefined, 10); + let f22 = C.bind(undefined, 10, "hello"); + let f23 = C.bind(undefined, 10, 20); // Error + ~~ +!!! error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. + + C.call(c, 10, "hello"); + C.call(c, 10); // Error + ~~~~~~~~~~~~~ +!!! error TS2554: Expected 3 arguments, but got 2. + C.call(c, 10, 20); // Error + ~~ +!!! error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. + C.call(c, 10, "hello", 30); // Error + ~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2554: Expected 3 arguments, but got 4. + + C.apply(c, [10, "hello"]); + C.apply(c, [10]); // Error + ~~~~ +!!! error TS2345: Argument of type '[number]' is not assignable to parameter of type '[number, string]'. + C.apply(c, [10, 20]); // Error + ~~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. + C.apply(c, [10, "hello", 30]); // Error + ~~~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '[number, string, number]' is not assignable to parameter of type '[number, string]'. + \ No newline at end of file diff --git a/tests/baselines/reference/strictBindCallApply1.js b/tests/baselines/reference/strictBindCallApply1.js new file mode 100644 index 00000000000..e43c84edbf1 --- /dev/null +++ b/tests/baselines/reference/strictBindCallApply1.js @@ -0,0 +1,107 @@ +//// [strictBindCallApply1.ts] +declare function foo(a: number, b: string): string; + +let f00 = foo.bind(undefined); +let f01 = foo.bind(undefined, 10); +let f02 = foo.bind(undefined, 10, "hello"); +let f03 = foo.bind(undefined, 10, 20); // Error + +let c00 = foo.call(undefined, 10, "hello"); +let c01 = foo.call(undefined, 10); // Error +let c02 = foo.call(undefined, 10, 20); // Error +let c03 = foo.call(undefined, 10, "hello", 30); // Error + +let a00 = foo.apply(undefined, [10, "hello"]); +let a01 = foo.apply(undefined, [10]); // Error +let a02 = foo.apply(undefined, [10, 20]); // Error +let a03 = foo.apply(undefined, [10, "hello", 30]); // Error + +class C { + constructor(a: number, b: string) {} + foo(this: this, a: number, b: string): string { return "" } +} + +declare let c: C; +declare let obj: {}; + +let f10 = c.foo.bind(c); +let f11 = c.foo.bind(c, 10); +let f12 = c.foo.bind(c, 10, "hello"); +let f13 = c.foo.bind(c, 10, 20); // Error +let f14 = c.foo.bind(undefined); // Error + +let c10 = c.foo.call(c, 10, "hello"); +let c11 = c.foo.call(c, 10); // Error +let c12 = c.foo.call(c, 10, 20); // Error +let c13 = c.foo.call(c, 10, "hello", 30); // Error +let c14 = c.foo.call(undefined, 10, "hello"); // Error + +let a10 = c.foo.apply(c, [10, "hello"]); +let a11 = c.foo.apply(c, [10]); // Error +let a12 = c.foo.apply(c, [10, 20]); // Error +let a13 = c.foo.apply(c, [10, "hello", 30]); // Error +let a14 = c.foo.apply(undefined, [10, "hello"]); // Error + +let f20 = C.bind(undefined); +let f21 = C.bind(undefined, 10); +let f22 = C.bind(undefined, 10, "hello"); +let f23 = C.bind(undefined, 10, 20); // Error + +C.call(c, 10, "hello"); +C.call(c, 10); // Error +C.call(c, 10, 20); // Error +C.call(c, 10, "hello", 30); // Error + +C.apply(c, [10, "hello"]); +C.apply(c, [10]); // Error +C.apply(c, [10, 20]); // Error +C.apply(c, [10, "hello", 30]); // Error + + +//// [strictBindCallApply1.js] +"use strict"; +var f00 = foo.bind(undefined); +var f01 = foo.bind(undefined, 10); +var f02 = foo.bind(undefined, 10, "hello"); +var f03 = foo.bind(undefined, 10, 20); // Error +var c00 = foo.call(undefined, 10, "hello"); +var c01 = foo.call(undefined, 10); // Error +var c02 = foo.call(undefined, 10, 20); // Error +var c03 = foo.call(undefined, 10, "hello", 30); // Error +var a00 = foo.apply(undefined, [10, "hello"]); +var a01 = foo.apply(undefined, [10]); // Error +var a02 = foo.apply(undefined, [10, 20]); // Error +var a03 = foo.apply(undefined, [10, "hello", 30]); // Error +var C = /** @class */ (function () { + function C(a, b) { + } + C.prototype.foo = function (a, b) { return ""; }; + return C; +}()); +var f10 = c.foo.bind(c); +var f11 = c.foo.bind(c, 10); +var f12 = c.foo.bind(c, 10, "hello"); +var f13 = c.foo.bind(c, 10, 20); // Error +var f14 = c.foo.bind(undefined); // Error +var c10 = c.foo.call(c, 10, "hello"); +var c11 = c.foo.call(c, 10); // Error +var c12 = c.foo.call(c, 10, 20); // Error +var c13 = c.foo.call(c, 10, "hello", 30); // Error +var c14 = c.foo.call(undefined, 10, "hello"); // Error +var a10 = c.foo.apply(c, [10, "hello"]); +var a11 = c.foo.apply(c, [10]); // Error +var a12 = c.foo.apply(c, [10, 20]); // Error +var a13 = c.foo.apply(c, [10, "hello", 30]); // Error +var a14 = c.foo.apply(undefined, [10, "hello"]); // Error +var f20 = C.bind(undefined); +var f21 = C.bind(undefined, 10); +var f22 = C.bind(undefined, 10, "hello"); +var f23 = C.bind(undefined, 10, 20); // Error +C.call(c, 10, "hello"); +C.call(c, 10); // Error +C.call(c, 10, 20); // Error +C.call(c, 10, "hello", 30); // Error +C.apply(c, [10, "hello"]); +C.apply(c, [10]); // Error +C.apply(c, [10, 20]); // Error +C.apply(c, [10, "hello", 30]); // Error diff --git a/tests/baselines/reference/strictBindCallApply1.symbols b/tests/baselines/reference/strictBindCallApply1.symbols new file mode 100644 index 00000000000..1b49e96a0f0 --- /dev/null +++ b/tests/baselines/reference/strictBindCallApply1.symbols @@ -0,0 +1,322 @@ +=== tests/cases/conformance/functions/strictBindCallApply1.ts === +declare function foo(a: number, b: string): string; +>foo : Symbol(foo, Decl(strictBindCallApply1.ts, 0, 0)) +>a : Symbol(a, Decl(strictBindCallApply1.ts, 0, 21)) +>b : Symbol(b, Decl(strictBindCallApply1.ts, 0, 31)) + +let f00 = foo.bind(undefined); +>f00 : Symbol(f00, Decl(strictBindCallApply1.ts, 2, 3)) +>foo.bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>foo : Symbol(foo, Decl(strictBindCallApply1.ts, 0, 0)) +>bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +let f01 = foo.bind(undefined, 10); +>f01 : Symbol(f01, Decl(strictBindCallApply1.ts, 3, 3)) +>foo.bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>foo : Symbol(foo, Decl(strictBindCallApply1.ts, 0, 0)) +>bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +let f02 = foo.bind(undefined, 10, "hello"); +>f02 : Symbol(f02, Decl(strictBindCallApply1.ts, 4, 3)) +>foo.bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>foo : Symbol(foo, Decl(strictBindCallApply1.ts, 0, 0)) +>bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +let f03 = foo.bind(undefined, 10, 20); // Error +>f03 : Symbol(f03, Decl(strictBindCallApply1.ts, 5, 3)) +>foo.bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>foo : Symbol(foo, Decl(strictBindCallApply1.ts, 0, 0)) +>bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +let c00 = foo.call(undefined, 10, "hello"); +>c00 : Symbol(c00, Decl(strictBindCallApply1.ts, 7, 3)) +>foo.call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) +>foo : Symbol(foo, Decl(strictBindCallApply1.ts, 0, 0)) +>call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +let c01 = foo.call(undefined, 10); // Error +>c01 : Symbol(c01, Decl(strictBindCallApply1.ts, 8, 3)) +>foo.call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) +>foo : Symbol(foo, Decl(strictBindCallApply1.ts, 0, 0)) +>call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +let c02 = foo.call(undefined, 10, 20); // Error +>c02 : Symbol(c02, Decl(strictBindCallApply1.ts, 9, 3)) +>foo.call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) +>foo : Symbol(foo, Decl(strictBindCallApply1.ts, 0, 0)) +>call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +let c03 = foo.call(undefined, 10, "hello", 30); // Error +>c03 : Symbol(c03, Decl(strictBindCallApply1.ts, 10, 3)) +>foo.call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) +>foo : Symbol(foo, Decl(strictBindCallApply1.ts, 0, 0)) +>call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +let a00 = foo.apply(undefined, [10, "hello"]); +>a00 : Symbol(a00, Decl(strictBindCallApply1.ts, 12, 3)) +>foo.apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>foo : Symbol(foo, Decl(strictBindCallApply1.ts, 0, 0)) +>apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +let a01 = foo.apply(undefined, [10]); // Error +>a01 : Symbol(a01, Decl(strictBindCallApply1.ts, 13, 3)) +>foo.apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>foo : Symbol(foo, Decl(strictBindCallApply1.ts, 0, 0)) +>apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +let a02 = foo.apply(undefined, [10, 20]); // Error +>a02 : Symbol(a02, Decl(strictBindCallApply1.ts, 14, 3)) +>foo.apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>foo : Symbol(foo, Decl(strictBindCallApply1.ts, 0, 0)) +>apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +let a03 = foo.apply(undefined, [10, "hello", 30]); // Error +>a03 : Symbol(a03, Decl(strictBindCallApply1.ts, 15, 3)) +>foo.apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>foo : Symbol(foo, Decl(strictBindCallApply1.ts, 0, 0)) +>apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +class C { +>C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) + + constructor(a: number, b: string) {} +>a : Symbol(a, Decl(strictBindCallApply1.ts, 18, 16)) +>b : Symbol(b, Decl(strictBindCallApply1.ts, 18, 26)) + + foo(this: this, a: number, b: string): string { return "" } +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>this : Symbol(this, Decl(strictBindCallApply1.ts, 19, 8)) +>a : Symbol(a, Decl(strictBindCallApply1.ts, 19, 19)) +>b : Symbol(b, Decl(strictBindCallApply1.ts, 19, 30)) +} + +declare let c: C; +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) + +declare let obj: {}; +>obj : Symbol(obj, Decl(strictBindCallApply1.ts, 23, 11)) + +let f10 = c.foo.bind(c); +>f10 : Symbol(f10, Decl(strictBindCallApply1.ts, 25, 3)) +>c.foo.bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) + +let f11 = c.foo.bind(c, 10); +>f11 : Symbol(f11, Decl(strictBindCallApply1.ts, 26, 3)) +>c.foo.bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) + +let f12 = c.foo.bind(c, 10, "hello"); +>f12 : Symbol(f12, Decl(strictBindCallApply1.ts, 27, 3)) +>c.foo.bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) + +let f13 = c.foo.bind(c, 10, 20); // Error +>f13 : Symbol(f13, Decl(strictBindCallApply1.ts, 28, 3)) +>c.foo.bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) + +let f14 = c.foo.bind(undefined); // Error +>f14 : Symbol(f14, Decl(strictBindCallApply1.ts, 29, 3)) +>c.foo.bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +let c10 = c.foo.call(c, 10, "hello"); +>c10 : Symbol(c10, Decl(strictBindCallApply1.ts, 31, 3)) +>c.foo.call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) + +let c11 = c.foo.call(c, 10); // Error +>c11 : Symbol(c11, Decl(strictBindCallApply1.ts, 32, 3)) +>c.foo.call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) + +let c12 = c.foo.call(c, 10, 20); // Error +>c12 : Symbol(c12, Decl(strictBindCallApply1.ts, 33, 3)) +>c.foo.call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) + +let c13 = c.foo.call(c, 10, "hello", 30); // Error +>c13 : Symbol(c13, Decl(strictBindCallApply1.ts, 34, 3)) +>c.foo.call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) + +let c14 = c.foo.call(undefined, 10, "hello"); // Error +>c14 : Symbol(c14, Decl(strictBindCallApply1.ts, 35, 3)) +>c.foo.call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +let a10 = c.foo.apply(c, [10, "hello"]); +>a10 : Symbol(a10, Decl(strictBindCallApply1.ts, 37, 3)) +>c.foo.apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) + +let a11 = c.foo.apply(c, [10]); // Error +>a11 : Symbol(a11, Decl(strictBindCallApply1.ts, 38, 3)) +>c.foo.apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) + +let a12 = c.foo.apply(c, [10, 20]); // Error +>a12 : Symbol(a12, Decl(strictBindCallApply1.ts, 39, 3)) +>c.foo.apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) + +let a13 = c.foo.apply(c, [10, "hello", 30]); // Error +>a13 : Symbol(a13, Decl(strictBindCallApply1.ts, 40, 3)) +>c.foo.apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) + +let a14 = c.foo.apply(undefined, [10, "hello"]); // Error +>a14 : Symbol(a14, Decl(strictBindCallApply1.ts, 41, 3)) +>c.foo.apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +let f20 = C.bind(undefined); +>f20 : Symbol(f20, Decl(strictBindCallApply1.ts, 43, 3)) +>C.bind : Symbol(NewableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>bind : Symbol(NewableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +let f21 = C.bind(undefined, 10); +>f21 : Symbol(f21, Decl(strictBindCallApply1.ts, 44, 3)) +>C.bind : Symbol(NewableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>bind : Symbol(NewableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +let f22 = C.bind(undefined, 10, "hello"); +>f22 : Symbol(f22, Decl(strictBindCallApply1.ts, 45, 3)) +>C.bind : Symbol(NewableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>bind : Symbol(NewableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +let f23 = C.bind(undefined, 10, 20); // Error +>f23 : Symbol(f23, Decl(strictBindCallApply1.ts, 46, 3)) +>C.bind : Symbol(NewableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>bind : Symbol(NewableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +C.call(c, 10, "hello"); +>C.call : Symbol(NewableFunction.call, Decl(lib.es5.d.ts, --, --)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>call : Symbol(NewableFunction.call, Decl(lib.es5.d.ts, --, --)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) + +C.call(c, 10); // Error +>C.call : Symbol(NewableFunction.call, Decl(lib.es5.d.ts, --, --)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>call : Symbol(NewableFunction.call, Decl(lib.es5.d.ts, --, --)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) + +C.call(c, 10, 20); // Error +>C.call : Symbol(NewableFunction.call, Decl(lib.es5.d.ts, --, --)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>call : Symbol(NewableFunction.call, Decl(lib.es5.d.ts, --, --)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) + +C.call(c, 10, "hello", 30); // Error +>C.call : Symbol(NewableFunction.call, Decl(lib.es5.d.ts, --, --)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>call : Symbol(NewableFunction.call, Decl(lib.es5.d.ts, --, --)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) + +C.apply(c, [10, "hello"]); +>C.apply : Symbol(NewableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>apply : Symbol(NewableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) + +C.apply(c, [10]); // Error +>C.apply : Symbol(NewableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>apply : Symbol(NewableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) + +C.apply(c, [10, 20]); // Error +>C.apply : Symbol(NewableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>apply : Symbol(NewableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) + +C.apply(c, [10, "hello", 30]); // Error +>C.apply : Symbol(NewableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>apply : Symbol(NewableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) + diff --git a/tests/baselines/reference/strictBindCallApply1.types b/tests/baselines/reference/strictBindCallApply1.types new file mode 100644 index 00000000000..8e1607bf666 --- /dev/null +++ b/tests/baselines/reference/strictBindCallApply1.types @@ -0,0 +1,441 @@ +=== tests/cases/conformance/functions/strictBindCallApply1.ts === +declare function foo(a: number, b: string): string; +>foo : (a: number, b: string) => string +>a : number +>b : string + +let f00 = foo.bind(undefined); +>f00 : (a: number, b: string) => string +>foo.bind(undefined) : (a: number, b: string) => string +>foo.bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; } +>foo : (a: number, b: string) => string +>bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; } +>undefined : undefined + +let f01 = foo.bind(undefined, 10); +>f01 : (b: string) => string +>foo.bind(undefined, 10) : (b: string) => string +>foo.bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; } +>foo : (a: number, b: string) => string +>bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; } +>undefined : undefined +>10 : 10 + +let f02 = foo.bind(undefined, 10, "hello"); +>f02 : () => string +>foo.bind(undefined, 10, "hello") : () => string +>foo.bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; } +>foo : (a: number, b: string) => string +>bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; } +>undefined : undefined +>10 : 10 +>"hello" : "hello" + +let f03 = foo.bind(undefined, 10, 20); // Error +>f03 : any +>foo.bind(undefined, 10, 20) : any +>foo.bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; } +>foo : (a: number, b: string) => string +>bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; } +>undefined : undefined +>10 : 10 +>20 : 20 + +let c00 = foo.call(undefined, 10, "hello"); +>c00 : string +>foo.call(undefined, 10, "hello") : string +>foo.call : (this: (this: T, ...args: A) => R, thisArg: T, ...args: A) => R +>foo : (a: number, b: string) => string +>call : (this: (this: T, ...args: A) => R, thisArg: T, ...args: A) => R +>undefined : undefined +>10 : 10 +>"hello" : "hello" + +let c01 = foo.call(undefined, 10); // Error +>c01 : any +>foo.call(undefined, 10) : any +>foo.call : (this: (this: T, ...args: A) => R, thisArg: T, ...args: A) => R +>foo : (a: number, b: string) => string +>call : (this: (this: T, ...args: A) => R, thisArg: T, ...args: A) => R +>undefined : undefined +>10 : 10 + +let c02 = foo.call(undefined, 10, 20); // Error +>c02 : any +>foo.call(undefined, 10, 20) : any +>foo.call : (this: (this: T, ...args: A) => R, thisArg: T, ...args: A) => R +>foo : (a: number, b: string) => string +>call : (this: (this: T, ...args: A) => R, thisArg: T, ...args: A) => R +>undefined : undefined +>10 : 10 +>20 : 20 + +let c03 = foo.call(undefined, 10, "hello", 30); // Error +>c03 : any +>foo.call(undefined, 10, "hello", 30) : any +>foo.call : (this: (this: T, ...args: A) => R, thisArg: T, ...args: A) => R +>foo : (a: number, b: string) => string +>call : (this: (this: T, ...args: A) => R, thisArg: T, ...args: A) => R +>undefined : undefined +>10 : 10 +>"hello" : "hello" +>30 : 30 + +let a00 = foo.apply(undefined, [10, "hello"]); +>a00 : string +>foo.apply(undefined, [10, "hello"]) : string +>foo.apply : { (this: (this: T) => R, thisArg: T): R; (this: (this: T, ...args: A) => R, thisArg: T, args: A): R; } +>foo : (a: number, b: string) => string +>apply : { (this: (this: T) => R, thisArg: T): R; (this: (this: T, ...args: A) => R, thisArg: T, args: A): R; } +>undefined : undefined +>[10, "hello"] : [number, string] +>10 : 10 +>"hello" : "hello" + +let a01 = foo.apply(undefined, [10]); // Error +>a01 : any +>foo.apply(undefined, [10]) : any +>foo.apply : { (this: (this: T) => R, thisArg: T): R; (this: (this: T, ...args: A) => R, thisArg: T, args: A): R; } +>foo : (a: number, b: string) => string +>apply : { (this: (this: T) => R, thisArg: T): R; (this: (this: T, ...args: A) => R, thisArg: T, args: A): R; } +>undefined : undefined +>[10] : number[] +>10 : 10 + +let a02 = foo.apply(undefined, [10, 20]); // Error +>a02 : any +>foo.apply(undefined, [10, 20]) : any +>foo.apply : { (this: (this: T) => R, thisArg: T): R; (this: (this: T, ...args: A) => R, thisArg: T, args: A): R; } +>foo : (a: number, b: string) => string +>apply : { (this: (this: T) => R, thisArg: T): R; (this: (this: T, ...args: A) => R, thisArg: T, args: A): R; } +>undefined : undefined +>[10, 20] : number[] +>10 : 10 +>20 : 20 + +let a03 = foo.apply(undefined, [10, "hello", 30]); // Error +>a03 : any +>foo.apply(undefined, [10, "hello", 30]) : any +>foo.apply : { (this: (this: T) => R, thisArg: T): R; (this: (this: T, ...args: A) => R, thisArg: T, args: A): R; } +>foo : (a: number, b: string) => string +>apply : { (this: (this: T) => R, thisArg: T): R; (this: (this: T, ...args: A) => R, thisArg: T, args: A): R; } +>undefined : undefined +>[10, "hello", 30] : (string | number)[] +>10 : 10 +>"hello" : "hello" +>30 : 30 + +class C { +>C : C + + constructor(a: number, b: string) {} +>a : number +>b : string + + foo(this: this, a: number, b: string): string { return "" } +>foo : (this: this, a: number, b: string) => string +>this : this +>a : number +>b : string +>"" : "" +} + +declare let c: C; +>c : C + +declare let obj: {}; +>obj : {} + +let f10 = c.foo.bind(c); +>f10 : (a: number, b: string) => string +>c.foo.bind(c) : (a: number, b: string) => string +>c.foo.bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; } +>c.foo : (this: C, a: number, b: string) => string +>c : C +>foo : (this: C, a: number, b: string) => string +>bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; } +>c : C + +let f11 = c.foo.bind(c, 10); +>f11 : (b: string) => string +>c.foo.bind(c, 10) : (b: string) => string +>c.foo.bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; } +>c.foo : (this: C, a: number, b: string) => string +>c : C +>foo : (this: C, a: number, b: string) => string +>bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; } +>c : C +>10 : 10 + +let f12 = c.foo.bind(c, 10, "hello"); +>f12 : () => string +>c.foo.bind(c, 10, "hello") : () => string +>c.foo.bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; } +>c.foo : (this: C, a: number, b: string) => string +>c : C +>foo : (this: C, a: number, b: string) => string +>bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; } +>c : C +>10 : 10 +>"hello" : "hello" + +let f13 = c.foo.bind(c, 10, 20); // Error +>f13 : any +>c.foo.bind(c, 10, 20) : any +>c.foo.bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; } +>c.foo : (this: C, a: number, b: string) => string +>c : C +>foo : (this: C, a: number, b: string) => string +>bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; } +>c : C +>10 : 10 +>20 : 20 + +let f14 = c.foo.bind(undefined); // Error +>f14 : any +>c.foo.bind(undefined) : any +>c.foo.bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; } +>c.foo : (this: C, a: number, b: string) => string +>c : C +>foo : (this: C, a: number, b: string) => string +>bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; } +>undefined : undefined + +let c10 = c.foo.call(c, 10, "hello"); +>c10 : string +>c.foo.call(c, 10, "hello") : string +>c.foo.call : (this: (this: T, ...args: A) => R, thisArg: T, ...args: A) => R +>c.foo : (this: C, a: number, b: string) => string +>c : C +>foo : (this: C, a: number, b: string) => string +>call : (this: (this: T, ...args: A) => R, thisArg: T, ...args: A) => R +>c : C +>10 : 10 +>"hello" : "hello" + +let c11 = c.foo.call(c, 10); // Error +>c11 : any +>c.foo.call(c, 10) : any +>c.foo.call : (this: (this: T, ...args: A) => R, thisArg: T, ...args: A) => R +>c.foo : (this: C, a: number, b: string) => string +>c : C +>foo : (this: C, a: number, b: string) => string +>call : (this: (this: T, ...args: A) => R, thisArg: T, ...args: A) => R +>c : C +>10 : 10 + +let c12 = c.foo.call(c, 10, 20); // Error +>c12 : any +>c.foo.call(c, 10, 20) : any +>c.foo.call : (this: (this: T, ...args: A) => R, thisArg: T, ...args: A) => R +>c.foo : (this: C, a: number, b: string) => string +>c : C +>foo : (this: C, a: number, b: string) => string +>call : (this: (this: T, ...args: A) => R, thisArg: T, ...args: A) => R +>c : C +>10 : 10 +>20 : 20 + +let c13 = c.foo.call(c, 10, "hello", 30); // Error +>c13 : any +>c.foo.call(c, 10, "hello", 30) : any +>c.foo.call : (this: (this: T, ...args: A) => R, thisArg: T, ...args: A) => R +>c.foo : (this: C, a: number, b: string) => string +>c : C +>foo : (this: C, a: number, b: string) => string +>call : (this: (this: T, ...args: A) => R, thisArg: T, ...args: A) => R +>c : C +>10 : 10 +>"hello" : "hello" +>30 : 30 + +let c14 = c.foo.call(undefined, 10, "hello"); // Error +>c14 : any +>c.foo.call(undefined, 10, "hello") : any +>c.foo.call : (this: (this: T, ...args: A) => R, thisArg: T, ...args: A) => R +>c.foo : (this: C, a: number, b: string) => string +>c : C +>foo : (this: C, a: number, b: string) => string +>call : (this: (this: T, ...args: A) => R, thisArg: T, ...args: A) => R +>undefined : undefined +>10 : 10 +>"hello" : "hello" + +let a10 = c.foo.apply(c, [10, "hello"]); +>a10 : string +>c.foo.apply(c, [10, "hello"]) : string +>c.foo.apply : { (this: (this: T) => R, thisArg: T): R; (this: (this: T, ...args: A) => R, thisArg: T, args: A): R; } +>c.foo : (this: C, a: number, b: string) => string +>c : C +>foo : (this: C, a: number, b: string) => string +>apply : { (this: (this: T) => R, thisArg: T): R; (this: (this: T, ...args: A) => R, thisArg: T, args: A): R; } +>c : C +>[10, "hello"] : [number, string] +>10 : 10 +>"hello" : "hello" + +let a11 = c.foo.apply(c, [10]); // Error +>a11 : any +>c.foo.apply(c, [10]) : any +>c.foo.apply : { (this: (this: T) => R, thisArg: T): R; (this: (this: T, ...args: A) => R, thisArg: T, args: A): R; } +>c.foo : (this: C, a: number, b: string) => string +>c : C +>foo : (this: C, a: number, b: string) => string +>apply : { (this: (this: T) => R, thisArg: T): R; (this: (this: T, ...args: A) => R, thisArg: T, args: A): R; } +>c : C +>[10] : number[] +>10 : 10 + +let a12 = c.foo.apply(c, [10, 20]); // Error +>a12 : any +>c.foo.apply(c, [10, 20]) : any +>c.foo.apply : { (this: (this: T) => R, thisArg: T): R; (this: (this: T, ...args: A) => R, thisArg: T, args: A): R; } +>c.foo : (this: C, a: number, b: string) => string +>c : C +>foo : (this: C, a: number, b: string) => string +>apply : { (this: (this: T) => R, thisArg: T): R; (this: (this: T, ...args: A) => R, thisArg: T, args: A): R; } +>c : C +>[10, 20] : number[] +>10 : 10 +>20 : 20 + +let a13 = c.foo.apply(c, [10, "hello", 30]); // Error +>a13 : any +>c.foo.apply(c, [10, "hello", 30]) : any +>c.foo.apply : { (this: (this: T) => R, thisArg: T): R; (this: (this: T, ...args: A) => R, thisArg: T, args: A): R; } +>c.foo : (this: C, a: number, b: string) => string +>c : C +>foo : (this: C, a: number, b: string) => string +>apply : { (this: (this: T) => R, thisArg: T): R; (this: (this: T, ...args: A) => R, thisArg: T, args: A): R; } +>c : C +>[10, "hello", 30] : (string | number)[] +>10 : 10 +>"hello" : "hello" +>30 : 30 + +let a14 = c.foo.apply(undefined, [10, "hello"]); // Error +>a14 : any +>c.foo.apply(undefined, [10, "hello"]) : any +>c.foo.apply : { (this: (this: T) => R, thisArg: T): R; (this: (this: T, ...args: A) => R, thisArg: T, args: A): R; } +>c.foo : (this: C, a: number, b: string) => string +>c : C +>foo : (this: C, a: number, b: string) => string +>apply : { (this: (this: T) => R, thisArg: T): R; (this: (this: T, ...args: A) => R, thisArg: T, args: A): R; } +>undefined : undefined +>[10, "hello"] : (string | number)[] +>10 : 10 +>"hello" : "hello" + +let f20 = C.bind(undefined); +>f20 : new (a: number, b: string) => C +>C.bind(undefined) : new (a: number, b: string) => C +>C.bind : { (this: new (...args: A) => R, thisArg: any): new (...args: A) => R; (this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R; } +>C : typeof C +>bind : { (this: new (...args: A) => R, thisArg: any): new (...args: A) => R; (this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R; } +>undefined : undefined + +let f21 = C.bind(undefined, 10); +>f21 : new (b: string) => C +>C.bind(undefined, 10) : new (b: string) => C +>C.bind : { (this: new (...args: A) => R, thisArg: any): new (...args: A) => R; (this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R; } +>C : typeof C +>bind : { (this: new (...args: A) => R, thisArg: any): new (...args: A) => R; (this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R; } +>undefined : undefined +>10 : 10 + +let f22 = C.bind(undefined, 10, "hello"); +>f22 : new () => C +>C.bind(undefined, 10, "hello") : new () => C +>C.bind : { (this: new (...args: A) => R, thisArg: any): new (...args: A) => R; (this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R; } +>C : typeof C +>bind : { (this: new (...args: A) => R, thisArg: any): new (...args: A) => R; (this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R; } +>undefined : undefined +>10 : 10 +>"hello" : "hello" + +let f23 = C.bind(undefined, 10, 20); // Error +>f23 : any +>C.bind(undefined, 10, 20) : any +>C.bind : { (this: new (...args: A) => R, thisArg: any): new (...args: A) => R; (this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R; } +>C : typeof C +>bind : { (this: new (...args: A) => R, thisArg: any): new (...args: A) => R; (this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R; } +>undefined : undefined +>10 : 10 +>20 : 20 + +C.call(c, 10, "hello"); +>C.call(c, 10, "hello") : void +>C.call : (this: new (...args: A) => T, thisArg: T, ...args: A) => void +>C : typeof C +>call : (this: new (...args: A) => T, thisArg: T, ...args: A) => void +>c : C +>10 : 10 +>"hello" : "hello" + +C.call(c, 10); // Error +>C.call(c, 10) : any +>C.call : (this: new (...args: A) => T, thisArg: T, ...args: A) => void +>C : typeof C +>call : (this: new (...args: A) => T, thisArg: T, ...args: A) => void +>c : C +>10 : 10 + +C.call(c, 10, 20); // Error +>C.call(c, 10, 20) : any +>C.call : (this: new (...args: A) => T, thisArg: T, ...args: A) => void +>C : typeof C +>call : (this: new (...args: A) => T, thisArg: T, ...args: A) => void +>c : C +>10 : 10 +>20 : 20 + +C.call(c, 10, "hello", 30); // Error +>C.call(c, 10, "hello", 30) : any +>C.call : (this: new (...args: A) => T, thisArg: T, ...args: A) => void +>C : typeof C +>call : (this: new (...args: A) => T, thisArg: T, ...args: A) => void +>c : C +>10 : 10 +>"hello" : "hello" +>30 : 30 + +C.apply(c, [10, "hello"]); +>C.apply(c, [10, "hello"]) : void +>C.apply : { (this: new () => T, thisArg: T): void; (this: new (...args: A) => T, thisArg: T, args: A): void; } +>C : typeof C +>apply : { (this: new () => T, thisArg: T): void; (this: new (...args: A) => T, thisArg: T, args: A): void; } +>c : C +>[10, "hello"] : [number, string] +>10 : 10 +>"hello" : "hello" + +C.apply(c, [10]); // Error +>C.apply(c, [10]) : any +>C.apply : { (this: new () => T, thisArg: T): void; (this: new (...args: A) => T, thisArg: T, args: A): void; } +>C : typeof C +>apply : { (this: new () => T, thisArg: T): void; (this: new (...args: A) => T, thisArg: T, args: A): void; } +>c : C +>[10] : number[] +>10 : 10 + +C.apply(c, [10, 20]); // Error +>C.apply(c, [10, 20]) : any +>C.apply : { (this: new () => T, thisArg: T): void; (this: new (...args: A) => T, thisArg: T, args: A): void; } +>C : typeof C +>apply : { (this: new () => T, thisArg: T): void; (this: new (...args: A) => T, thisArg: T, args: A): void; } +>c : C +>[10, 20] : number[] +>10 : 10 +>20 : 20 + +C.apply(c, [10, "hello", 30]); // Error +>C.apply(c, [10, "hello", 30]) : any +>C.apply : { (this: new () => T, thisArg: T): void; (this: new (...args: A) => T, thisArg: T, args: A): void; } +>C : typeof C +>apply : { (this: new () => T, thisArg: T): void; (this: new (...args: A) => T, thisArg: T, args: A): void; } +>c : C +>[10, "hello", 30] : (string | number)[] +>10 : 10 +>"hello" : "hello" +>30 : 30 +