From 9cc997fca76d0befe9ba42803a6be9263f2b24dc Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sat, 8 Dec 2018 11:02:19 -0800 Subject: [PATCH 1/6] Improve typing of 'bind' method on function types --- src/lib/es5.d.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index c8e99f0d1dbaf..308af721af625 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -295,6 +295,16 @@ interface FunctionConstructor { declare const Function: FunctionConstructor; +/** + * Extracts the type of the 'this' parameter of a function type, or 'unknown' if the function type has no 'this' parameter. + */ +type ThisParameterType = T extends (this: unknown, ...args: any[]) => any ? unknown : T extends (this: infer U, ...args: any[]) => any ? U : unknown; + +/** + * Removes the 'this' parameter from a function type. + */ +type OmitThisParameter = unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T; + interface CallableFunction extends Function { /** * Calls the function with the specified object as the this value and the elements of specified array as the arguments. @@ -317,7 +327,7 @@ interface CallableFunction extends Function { * @param thisArg The object to be used as the this object. * @param args Arguments to bind to the parameters of the function. */ - bind(this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; + bind(this: T, thisArg: ThisParameterType): OmitThisParameter; bind(this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; bind(this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; bind(this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; @@ -347,7 +357,7 @@ interface NewableFunction extends Function { * @param thisArg The object to be used as the this object. * @param args Arguments to bind to the parameters of the function. */ - bind(this: new (...args: A) => R, thisArg: any): new (...args: A) => R; + bind(this: T, thisArg: any): T; bind(this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; bind(this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; bind(this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; From aea2a12d79d76b8240dffbf2f6996d8e80e1a80c Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sat, 8 Dec 2018 11:03:00 -0800 Subject: [PATCH 2/6] Accept new baselines --- ...tructuringParameterDeclaration4.errors.txt | 2 +- .../reference/externModule.errors.txt | 8 +-- ...mUsingES6FeaturesWithOnlyES5Lib.errors.txt | 2 +- ...wExceptionVariableInCatchClause.errors.txt | 2 +- .../narrowFromAnyWithInstanceof.errors.txt | 4 +- .../narrowFromAnyWithTypePredicate.errors.txt | 4 +- ...erAccessAfterPostfixExpression1.errors.txt | 2 +- .../reference/parserS7.2_A1.5_T2.errors.txt | 4 +- .../reference/parserS7.3_A1.1_T2.errors.txt | 2 +- .../reference/parserS7.6_A4.2_T1.errors.txt | 20 +++---- .../reference/parserUnicode1.errors.txt | 4 +- .../reference/promisePermutations.errors.txt | 2 +- .../reference/promisePermutations2.errors.txt | 2 +- .../reference/promisePermutations3.errors.txt | 4 +- .../reference/promiseTypeInference.errors.txt | 2 +- .../reference/scannerS7.2_A1.5_T2.errors.txt | 4 +- .../reference/scannerS7.3_A1.1_T2.errors.txt | 2 +- .../reference/scannerS7.6_A4.2_T1.errors.txt | 20 +++---- .../reference/strictBindCallApply1.types | 56 +++++++++---------- ...eStringsWithOverloadResolution1.errors.txt | 2 +- ...ingsWithOverloadResolution1_ES6.errors.txt | 2 +- 21 files changed, 75 insertions(+), 75 deletions(-) diff --git a/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt b/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt index e51ee68b60414..035d912b638ff 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt +++ b/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt @@ -41,7 +41,7 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts( a1(...array2); // Error parameter type is (number|string)[] ~~~~~~ !!! error TS2552: Cannot find name 'array2'. Did you mean 'Array'? -!!! related TS2728 /.ts/lib.es5.d.ts:1358:15: 'Array' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1368:15: 'Array' is declared here. a5([1, 2, "string", false, true]); // Error, parameter type is [any, any, [[any]]] ~~~~~~~~ !!! error TS2322: Type 'string' is not assignable to type '[[any]]'. diff --git a/tests/baselines/reference/externModule.errors.txt b/tests/baselines/reference/externModule.errors.txt index 377fe025cc6f8..8e95e2c8101f3 100644 --- a/tests/baselines/reference/externModule.errors.txt +++ b/tests/baselines/reference/externModule.errors.txt @@ -69,20 +69,20 @@ tests/cases/compiler/externModule.ts(37,3): error TS2552: Cannot find name 'XDat var d=new XDate(); ~~~~~ !!! error TS2552: Cannot find name 'XDate'. Did you mean 'Date'? -!!! related TS2728 /.ts/lib.es5.d.ts:897:15: 'Date' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:907:15: 'Date' is declared here. d.getDay(); d=new XDate(1978,2); ~~~~~ !!! error TS2552: Cannot find name 'XDate'. Did you mean 'Date'? -!!! related TS2728 /.ts/lib.es5.d.ts:897:15: 'Date' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:907:15: 'Date' is declared here. d.getXDate(); var n=XDate.parse("3/2/2004"); ~~~~~ !!! error TS2552: Cannot find name 'XDate'. Did you mean 'Date'? -!!! related TS2728 /.ts/lib.es5.d.ts:897:15: 'Date' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:907:15: 'Date' is declared here. n=XDate.UTC(1964,2,1); ~~~~~ !!! error TS2552: Cannot find name 'XDate'. Did you mean 'Date'? -!!! related TS2728 /.ts/lib.es5.d.ts:897:15: 'Date' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:907:15: 'Date' is declared here. \ No newline at end of file diff --git a/tests/baselines/reference/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.errors.txt b/tests/baselines/reference/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.errors.txt index f2c77d6298468..db1b28401327f 100644 --- a/tests/baselines/reference/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.errors.txt +++ b/tests/baselines/reference/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.errors.txt @@ -41,7 +41,7 @@ tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.t Math.sign(1); ~~~~ !!! error TS2551: Property 'sign' does not exist on type 'Math'. Did you mean 'sin'? -!!! related TS2728 /.ts/lib.es5.d.ts:703:5: 'sin' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:713:5: 'sin' is declared here. // Using ES6 object var o = { diff --git a/tests/baselines/reference/narrowExceptionVariableInCatchClause.errors.txt b/tests/baselines/reference/narrowExceptionVariableInCatchClause.errors.txt index 12b2790c3de63..c5a85483631f2 100644 --- a/tests/baselines/reference/narrowExceptionVariableInCatchClause.errors.txt +++ b/tests/baselines/reference/narrowExceptionVariableInCatchClause.errors.txt @@ -24,7 +24,7 @@ tests/cases/conformance/types/any/narrowExceptionVariableInCatchClause.ts(16,17) err.massage; // ERROR: Property 'massage' does not exist on type 'Error' ~~~~~~~ !!! error TS2551: Property 'massage' does not exist on type 'Error'. Did you mean 'message'? -!!! related TS2728 /.ts/lib.es5.d.ts:964:5: 'message' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:974:5: 'message' is declared here. } else { diff --git a/tests/baselines/reference/narrowFromAnyWithInstanceof.errors.txt b/tests/baselines/reference/narrowFromAnyWithInstanceof.errors.txt index f5c0c5728f18d..6e7ae406bcfa0 100644 --- a/tests/baselines/reference/narrowFromAnyWithInstanceof.errors.txt +++ b/tests/baselines/reference/narrowFromAnyWithInstanceof.errors.txt @@ -22,7 +22,7 @@ tests/cases/conformance/types/any/narrowFromAnyWithInstanceof.ts(22,7): error TS x.mesage; ~~~~~~ !!! error TS2551: Property 'mesage' does not exist on type 'Error'. Did you mean 'message'? -!!! related TS2728 /.ts/lib.es5.d.ts:964:5: 'message' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:974:5: 'message' is declared here. } if (x instanceof Date) { @@ -30,6 +30,6 @@ tests/cases/conformance/types/any/narrowFromAnyWithInstanceof.ts(22,7): error TS x.getHuors(); ~~~~~~~~ !!! error TS2551: Property 'getHuors' does not exist on type 'Date'. Did you mean 'getHours'? -!!! related TS2728 /.ts/lib.es5.d.ts:753:5: 'getHours' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:763:5: 'getHours' is declared here. } \ No newline at end of file diff --git a/tests/baselines/reference/narrowFromAnyWithTypePredicate.errors.txt b/tests/baselines/reference/narrowFromAnyWithTypePredicate.errors.txt index 385357f2204f1..0cf20b5c86bab 100644 --- a/tests/baselines/reference/narrowFromAnyWithTypePredicate.errors.txt +++ b/tests/baselines/reference/narrowFromAnyWithTypePredicate.errors.txt @@ -39,7 +39,7 @@ tests/cases/conformance/types/any/narrowFromAnyWithTypePredicate.ts(33,7): error x.mesage; ~~~~~~ !!! error TS2551: Property 'mesage' does not exist on type 'Error'. Did you mean 'message'? -!!! related TS2728 /.ts/lib.es5.d.ts:964:5: 'message' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:974:5: 'message' is declared here. } if (isDate(x)) { @@ -47,6 +47,6 @@ tests/cases/conformance/types/any/narrowFromAnyWithTypePredicate.ts(33,7): error x.getHuors(); ~~~~~~~~ !!! error TS2551: Property 'getHuors' does not exist on type 'Date'. Did you mean 'getHours'? -!!! related TS2728 /.ts/lib.es5.d.ts:753:5: 'getHours' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:763:5: 'getHours' is declared here. } \ No newline at end of file diff --git a/tests/baselines/reference/parserMemberAccessAfterPostfixExpression1.errors.txt b/tests/baselines/reference/parserMemberAccessAfterPostfixExpression1.errors.txt index bd7db9c44fe86..ab9d0a34a5590 100644 --- a/tests/baselines/reference/parserMemberAccessAfterPostfixExpression1.errors.txt +++ b/tests/baselines/reference/parserMemberAccessAfterPostfixExpression1.errors.txt @@ -11,4 +11,4 @@ tests/cases/conformance/parser/ecmascript5/Expressions/parserMemberAccessAfterPo !!! error TS1005: ';' expected. ~~~~~~~~ !!! error TS2552: Cannot find name 'toString'. Did you mean 'String'? -!!! related TS2728 /.ts/lib.es5.d.ts:517:15: 'String' is declared here. \ No newline at end of file +!!! related TS2728 /.ts/lib.es5.d.ts:527:15: 'String' is declared here. \ No newline at end of file diff --git a/tests/baselines/reference/parserS7.2_A1.5_T2.errors.txt b/tests/baselines/reference/parserS7.2_A1.5_T2.errors.txt index 136d4477268c8..5d1059f6effb8 100644 --- a/tests/baselines/reference/parserS7.2_A1.5_T2.errors.txt +++ b/tests/baselines/reference/parserS7.2_A1.5_T2.errors.txt @@ -19,7 +19,7 @@ tests/cases/conformance/parser/ecmascript5/parserS7.2_A1.5_T2.ts(20,3): error TS $ERROR('#1: eval("\\u00A0var x\\u00A0= 1\\u00A0"); x === 1. Actual: ' + (x)); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } //CHECK#2 @@ -28,7 +28,7 @@ tests/cases/conformance/parser/ecmascript5/parserS7.2_A1.5_T2.ts(20,3): error TS $ERROR('#2:  var x = 1 ; x === 1. Actual: ' + (x)); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } diff --git a/tests/baselines/reference/parserS7.3_A1.1_T2.errors.txt b/tests/baselines/reference/parserS7.3_A1.1_T2.errors.txt index 3a35d5f0a8379..1f8845e808a43 100644 --- a/tests/baselines/reference/parserS7.3_A1.1_T2.errors.txt +++ b/tests/baselines/reference/parserS7.3_A1.1_T2.errors.txt @@ -21,7 +21,7 @@ tests/cases/conformance/parser/ecmascript5/parserS7.3_A1.1_T2.ts(17,3): error TS $ERROR('#1: var\\nx\\n=\\n1\\n; x === 1. Actual: ' + (x)); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } \ No newline at end of file diff --git a/tests/baselines/reference/parserS7.6_A4.2_T1.errors.txt b/tests/baselines/reference/parserS7.6_A4.2_T1.errors.txt index 35fc8935b7391..4242d1faecab2 100644 --- a/tests/baselines/reference/parserS7.6_A4.2_T1.errors.txt +++ b/tests/baselines/reference/parserS7.6_A4.2_T1.errors.txt @@ -50,70 +50,70 @@ tests/cases/conformance/parser/ecmascript5/parserS7.6_A4.2_T1.ts(142,3): error T $ERROR('#А'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } var \u0411 = 1; if (Б !== 1) { $ERROR('#Б'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } var \u0412 = 1; if (В !== 1) { $ERROR('#В'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } var \u0413 = 1; if (Г !== 1) { $ERROR('#Г'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } var \u0414 = 1; if (Д !== 1) { $ERROR('#Д'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } var \u0415 = 1; if (Е !== 1) { $ERROR('#Е'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } var \u0416 = 1; if (Ж !== 1) { $ERROR('#Ж'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } var \u0417 = 1; if (З !== 1) { $ERROR('#З'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } var \u0418 = 1; if (И !== 1) { $ERROR('#И'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } var \u0419 = 1; if (Й !== 1) { $ERROR('#Й'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } var \u041A = 1; if (К !== 1) { diff --git a/tests/baselines/reference/parserUnicode1.errors.txt b/tests/baselines/reference/parserUnicode1.errors.txt index 2e16f696620f4..aa9cf50471466 100644 --- a/tests/baselines/reference/parserUnicode1.errors.txt +++ b/tests/baselines/reference/parserUnicode1.errors.txt @@ -11,13 +11,13 @@ tests/cases/conformance/parser/ecmascript5/parserUnicode1.ts(10,5): error TS2552 $ERROR('#6.1: var \\u0078x = 1; xx === 6. Actual: ' + (xx)); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } } catch (e) { $ERROR('#6.2: var \\u0078x = 1; xx === 6. Actual: ' + (xx)); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } \ No newline at end of file diff --git a/tests/baselines/reference/promisePermutations.errors.txt b/tests/baselines/reference/promisePermutations.errors.txt index 7d1112dab175f..c719d8a9b951e 100644 --- a/tests/baselines/reference/promisePermutations.errors.txt +++ b/tests/baselines/reference/promisePermutations.errors.txt @@ -295,7 +295,7 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of t ~~~~~~~~~ !!! error TS2345: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => Promise'. !!! error TS2345: Property 'catch' is missing in type 'IPromise' but required in type 'Promise'. -!!! related TS2728 /.ts/lib.es5.d.ts:1403:5: 'catch' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1413:5: 'catch' is declared here. var s10g = s10.then(testFunctionP, nIPromise, sIPromise).then(sPromise, sIPromise, sIPromise); // ok var r11: IPromise; diff --git a/tests/baselines/reference/promisePermutations2.errors.txt b/tests/baselines/reference/promisePermutations2.errors.txt index 10abb661feb11..b88ef28ca5c51 100644 --- a/tests/baselines/reference/promisePermutations2.errors.txt +++ b/tests/baselines/reference/promisePermutations2.errors.txt @@ -294,7 +294,7 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of ~~~~~~~~~ !!! error TS2345: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => Promise'. !!! error TS2345: Property 'catch' is missing in type 'IPromise' but required in type 'Promise'. -!!! related TS2728 /.ts/lib.es5.d.ts:1403:5: 'catch' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1413:5: 'catch' is declared here. var s10g = s10.then(testFunctionP, nIPromise, sIPromise).then(sPromise, sIPromise, sIPromise); // ok var r11: IPromise; diff --git a/tests/baselines/reference/promisePermutations3.errors.txt b/tests/baselines/reference/promisePermutations3.errors.txt index 733eae63c5f13..7f12ee8609a64 100644 --- a/tests/baselines/reference/promisePermutations3.errors.txt +++ b/tests/baselines/reference/promisePermutations3.errors.txt @@ -303,7 +303,7 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of ~~~~~~~~~ !!! error TS2345: Argument of type '(x: any) => IPromise' is not assignable to parameter of type '(error: any) => Promise'. !!! error TS2345: Property 'catch' is missing in type 'IPromise' but required in type 'Promise'. -!!! related TS2728 /.ts/lib.es5.d.ts:1403:5: 'catch' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1413:5: 'catch' is declared here. var s10g = s10.then(testFunctionP, nIPromise, sIPromise).then(sPromise, sIPromise, sIPromise); // ok var r11: IPromise; @@ -340,5 +340,5 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of ~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '{ (x: T): IPromise; (x: T, y: T): Promise; }' is not assignable to parameter of type '(value: (x: any) => any) => Promise<{}>'. !!! error TS2345: Property 'catch' is missing in type 'IPromise' but required in type 'Promise<{}>'. -!!! related TS2728 /.ts/lib.es5.d.ts:1403:5: 'catch' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1413:5: 'catch' is declared here. var s12c = s12.then(testFunction12P, testFunction12, testFunction12); // ok \ No newline at end of file diff --git a/tests/baselines/reference/promiseTypeInference.errors.txt b/tests/baselines/reference/promiseTypeInference.errors.txt index 5edf8f5b0918e..1996f37e5402c 100644 --- a/tests/baselines/reference/promiseTypeInference.errors.txt +++ b/tests/baselines/reference/promiseTypeInference.errors.txt @@ -26,5 +26,5 @@ tests/cases/compiler/promiseTypeInference.ts(10,39): error TS2322: Type 'IPromis !!! error TS2322: Types of parameters 'success' and 'onfulfilled' are incompatible. !!! error TS2322: Type 'TResult1 | PromiseLike' is not assignable to type 'IPromise'. !!! error TS2322: Type 'TResult1' is not assignable to type 'IPromise'. -!!! related TS6502 /.ts/lib.es5.d.ts:1396:57: The expected type comes from the return type of this signature. +!!! related TS6502 /.ts/lib.es5.d.ts:1406:57: The expected type comes from the return type of this signature. \ No newline at end of file diff --git a/tests/baselines/reference/scannerS7.2_A1.5_T2.errors.txt b/tests/baselines/reference/scannerS7.2_A1.5_T2.errors.txt index f61392a51ecb4..473590f63e583 100644 --- a/tests/baselines/reference/scannerS7.2_A1.5_T2.errors.txt +++ b/tests/baselines/reference/scannerS7.2_A1.5_T2.errors.txt @@ -19,7 +19,7 @@ tests/cases/conformance/scanner/ecmascript5/scannerS7.2_A1.5_T2.ts(20,3): error $ERROR('#1: eval("\\u00A0var x\\u00A0= 1\\u00A0"); x === 1. Actual: ' + (x)); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } //CHECK#2 @@ -28,7 +28,7 @@ tests/cases/conformance/scanner/ecmascript5/scannerS7.2_A1.5_T2.ts(20,3): error $ERROR('#2:  var x = 1 ; x === 1. Actual: ' + (x)); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } diff --git a/tests/baselines/reference/scannerS7.3_A1.1_T2.errors.txt b/tests/baselines/reference/scannerS7.3_A1.1_T2.errors.txt index f7ab44d83d526..fa25b5cc170da 100644 --- a/tests/baselines/reference/scannerS7.3_A1.1_T2.errors.txt +++ b/tests/baselines/reference/scannerS7.3_A1.1_T2.errors.txt @@ -21,7 +21,7 @@ tests/cases/conformance/scanner/ecmascript5/scannerS7.3_A1.1_T2.ts(17,3): error $ERROR('#1: var\\nx\\n=\\n1\\n; x === 1. Actual: ' + (x)); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } \ No newline at end of file diff --git a/tests/baselines/reference/scannerS7.6_A4.2_T1.errors.txt b/tests/baselines/reference/scannerS7.6_A4.2_T1.errors.txt index ab3bddb5bc6cc..6dc7a99446b90 100644 --- a/tests/baselines/reference/scannerS7.6_A4.2_T1.errors.txt +++ b/tests/baselines/reference/scannerS7.6_A4.2_T1.errors.txt @@ -50,70 +50,70 @@ tests/cases/conformance/scanner/ecmascript5/scannerS7.6_A4.2_T1.ts(142,3): error $ERROR('#А'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } var \u0411 = 1; if (Б !== 1) { $ERROR('#Б'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } var \u0412 = 1; if (В !== 1) { $ERROR('#В'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } var \u0413 = 1; if (Г !== 1) { $ERROR('#Г'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } var \u0414 = 1; if (Д !== 1) { $ERROR('#Д'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } var \u0415 = 1; if (Е !== 1) { $ERROR('#Е'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } var \u0416 = 1; if (Ж !== 1) { $ERROR('#Ж'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } var \u0417 = 1; if (З !== 1) { $ERROR('#З'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } var \u0418 = 1; if (И !== 1) { $ERROR('#И'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } var \u0419 = 1; if (Й !== 1) { $ERROR('#Й'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here. } var \u041A = 1; if (К !== 1) { diff --git a/tests/baselines/reference/strictBindCallApply1.types b/tests/baselines/reference/strictBindCallApply1.types index a895447e18232..eb859d722d84b 100644 --- a/tests/baselines/reference/strictBindCallApply1.types +++ b/tests/baselines/reference/strictBindCallApply1.types @@ -7,26 +7,26 @@ declare function foo(a: number, b: string): 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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>foo.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => 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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => 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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>foo.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => 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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => 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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>foo.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => 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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } >undefined : undefined >10 : 10 >"hello" : "hello" @@ -34,9 +34,9 @@ let f02 = foo.bind(undefined, 10, "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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>foo.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => 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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } >undefined : undefined >10 : 10 >20 : 20 @@ -149,32 +149,32 @@ declare let 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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>c.foo.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => 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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => 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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>c.foo.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => 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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => 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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>c.foo.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => 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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } >c : C >10 : 10 >"hello" : "hello" @@ -182,11 +182,11 @@ let f12 = c.foo.bind(c, 10, "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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>c.foo.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => 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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } >c : C >10 : 10 >20 : 20 @@ -194,11 +194,11 @@ let f13 = c.foo.bind(c, 10, 20); // Error 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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>c.foo.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => 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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } >undefined : undefined let c10 = c.foo.call(c, 10, "hello"); @@ -327,28 +327,28 @@ let a14 = c.foo.apply(undefined, [10, "hello"]); // Error >"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; (this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; } +>f20 : typeof C +>C.bind(undefined) : typeof C +>C.bind : { (this: T, thisArg: any): T; (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; (this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => 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; (this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; } +>bind : { (this: T, thisArg: any): T; (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; (this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => 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; (this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; } +>C.bind : { (this: T, thisArg: any): T; (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; (this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => 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; (this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; } +>bind : { (this: T, thisArg: any): T; (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; (this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => 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; (this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; } +>C.bind : { (this: T, thisArg: any): T; (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; (this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => 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; (this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; } +>bind : { (this: T, thisArg: any): T; (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; (this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; } >undefined : undefined >10 : 10 >"hello" : "hello" @@ -356,9 +356,9 @@ let f22 = C.bind(undefined, 10, "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; (this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; } +>C.bind : { (this: T, thisArg: any): T; (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; (this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => 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; (this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; } +>bind : { (this: T, thisArg: any): T; (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; (this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; } >undefined : undefined >10 : 10 >20 : 20 diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.errors.txt index b70344e0a0669..f4bcdb5a1ac8e 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.errors.txt @@ -22,7 +22,7 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio ~~ !!! error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. !!! error TS2345: Property 'raw' is missing in type 'undefined[]' but required in type 'TemplateStringsArray'. -!!! related TS2728 /.ts/lib.es5.d.ts:595:14: 'raw' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:605:14: 'raw' is declared here. var b = foo([], 1); // string ~~ !!! error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1_ES6.errors.txt b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1_ES6.errors.txt index 7cdc02c457d99..a6f6708074cee 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1_ES6.errors.txt +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1_ES6.errors.txt @@ -22,7 +22,7 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio ~~ !!! error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. !!! error TS2345: Property 'raw' is missing in type 'undefined[]' but required in type 'TemplateStringsArray'. -!!! related TS2728 /.ts/lib.es5.d.ts:595:14: 'raw' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:605:14: 'raw' is declared here. var b = foo([], 1); // string ~~ !!! error TS2345: Argument of type 'undefined[]' is not assignable to parameter of type 'TemplateStringsArray'. From 992513791d032c0e68b7f20d6f903d8b1186f2de Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sat, 8 Dec 2018 11:03:37 -0800 Subject: [PATCH 3/6] Fix findAllReferences for 'this' parameter declarations --- src/services/findAllReferences.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index 0ed29a73bb58c..f290826690e01 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -1428,6 +1428,10 @@ namespace ts.FindAllReferences.Core { return [{ definition: { type: DefinitionKind.Symbol, symbol: searchSpaceNode.symbol }, references }]; } + function isParameterName(node: Node) { + return node.kind === SyntaxKind.Identifier && node.parent.kind === SyntaxKind.Parameter && (node.parent).name === node; + } + function getReferencesForThisKeyword(thisOrSuperKeyword: Node, sourceFiles: ReadonlyArray, cancellationToken: CancellationToken): SymbolAndEntries[] | undefined { let searchSpaceNode = getThisContainer(thisOrSuperKeyword, /* includeArrowFunctions */ false); @@ -1450,7 +1454,7 @@ namespace ts.FindAllReferences.Core { searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; case SyntaxKind.SourceFile: - if (isExternalModule(searchSpaceNode)) { + if (isExternalModule(searchSpaceNode) || isParameterName(thisOrSuperKeyword)) { return undefined; } // falls through @@ -1483,7 +1487,7 @@ namespace ts.FindAllReferences.Core { // and has the appropriate static modifier from the original container. return container.parent && searchSpaceNode.symbol === container.parent.symbol && (getModifierFlags(container) & ModifierFlags.Static) === staticFlag; case SyntaxKind.SourceFile: - return container.kind === SyntaxKind.SourceFile && !isExternalModule(container); + return container.kind === SyntaxKind.SourceFile && !isExternalModule(container) && !isParameterName(node); } }); }).map(n => nodeEntry(n)); From 201eec62304631864d78f4c7ec0e0e5383665c7b Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sat, 8 Dec 2018 11:20:31 -0800 Subject: [PATCH 4/6] Update fourslash list of global types --- src/harness/fourslash.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index b79a154c555fe..b02aff523d15b 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -4450,6 +4450,8 @@ namespace FourSlashInterface { interfaceEntry("ObjectConstructor"), constEntry("Function"), interfaceEntry("FunctionConstructor"), + typeEntry("ThisParameterType"), + typeEntry("OmitThisParameter"), interfaceEntry("CallableFunction"), interfaceEntry("NewableFunction"), interfaceEntry("IArguments"), From d2cc2821346d919485d7d1157c5524498f00c4bb Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Mon, 10 Dec 2018 09:45:55 -0800 Subject: [PATCH 5/6] Add tests --- .../conformance/functions/strictBindCallApply1.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/cases/conformance/functions/strictBindCallApply1.ts b/tests/cases/conformance/functions/strictBindCallApply1.ts index 5a94d4b54165f..4194c41ec24a7 100644 --- a/tests/cases/conformance/functions/strictBindCallApply1.ts +++ b/tests/cases/conformance/functions/strictBindCallApply1.ts @@ -2,11 +2,19 @@ declare function foo(a: number, b: string): string; +declare function overloaded(s: string): number; +declare function overloaded(n: number): string; + +declare function generic(x: T): T; + 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 f04 = overloaded.bind(undefined); // typeof overloaded +let f05 = generic.bind(undefined); // typeof generic + let c00 = foo.call(undefined, 10, "hello"); let c01 = foo.call(undefined, 10); // Error let c02 = foo.call(undefined, 10, 20); // Error @@ -20,6 +28,10 @@ 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 "" } + overloaded(s: string): number; + overloaded(n: number): string; + overloaded(x: any): any { return undefined } + generic(x: T): T { return x } } declare let c: C; @@ -31,6 +43,9 @@ 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 f15 = c.overloaded.bind(c); // typeof C.prototype.overloaded +let f16 = c.generic.bind(c); // typeof C.prototype.generic + 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 From 4d67c8f873b52809dff10b71444dde4b827698b6 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Mon, 10 Dec 2018 09:46:03 -0800 Subject: [PATCH 6/6] Accept new baselines --- .../reference/strictBindCallApply1.errors.txt | 63 ++-- .../reference/strictBindCallApply1.js | 21 ++ .../reference/strictBindCallApply1.symbols | 304 +++++++++++------- .../reference/strictBindCallApply1.types | 67 ++++ 4 files changed, 313 insertions(+), 142 deletions(-) diff --git a/tests/baselines/reference/strictBindCallApply1.errors.txt b/tests/baselines/reference/strictBindCallApply1.errors.txt index e8f48e5597c12..0931a837bac8e 100644 --- a/tests/baselines/reference/strictBindCallApply1.errors.txt +++ b/tests/baselines/reference/strictBindCallApply1.errors.txt @@ -1,35 +1,40 @@ -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]'. +tests/cases/conformance/functions/strictBindCallApply1.ts(11,35): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. +tests/cases/conformance/functions/strictBindCallApply1.ts(17,11): error TS2554: Expected 3 arguments, but got 2. +tests/cases/conformance/functions/strictBindCallApply1.ts(18,35): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. +tests/cases/conformance/functions/strictBindCallApply1.ts(19,11): error TS2554: Expected 3 arguments, but got 4. +tests/cases/conformance/functions/strictBindCallApply1.ts(22,32): error TS2345: Argument of type '[number]' is not assignable to parameter of type '[number, string]'. Property '1' is missing in type '[number]' but required in type '[number, string]'. -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]'. +tests/cases/conformance/functions/strictBindCallApply1.ts(23,37): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/functions/strictBindCallApply1.ts(24,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(41,29): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. +tests/cases/conformance/functions/strictBindCallApply1.ts(42,22): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'C'. +tests/cases/conformance/functions/strictBindCallApply1.ts(48,11): error TS2554: Expected 3 arguments, but got 2. +tests/cases/conformance/functions/strictBindCallApply1.ts(49,29): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. +tests/cases/conformance/functions/strictBindCallApply1.ts(50,11): error TS2554: Expected 3 arguments, but got 4. +tests/cases/conformance/functions/strictBindCallApply1.ts(51,22): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'C'. +tests/cases/conformance/functions/strictBindCallApply1.ts(54,26): error TS2345: Argument of type '[number]' is not assignable to parameter of type '[number, string]'. +tests/cases/conformance/functions/strictBindCallApply1.ts(55,31): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/functions/strictBindCallApply1.ts(56,26): error TS2345: Argument of type '[number, string, number]' is not assignable to parameter of type '[number, string]'. +tests/cases/conformance/functions/strictBindCallApply1.ts(57,23): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'C'. +tests/cases/conformance/functions/strictBindCallApply1.ts(62,33): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. +tests/cases/conformance/functions/strictBindCallApply1.ts(65,1): error TS2554: Expected 3 arguments, but got 2. +tests/cases/conformance/functions/strictBindCallApply1.ts(66,15): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. +tests/cases/conformance/functions/strictBindCallApply1.ts(67,1): error TS2554: Expected 3 arguments, but got 4. +tests/cases/conformance/functions/strictBindCallApply1.ts(70,12): error TS2345: Argument of type '[number]' is not assignable to parameter of type '[number, string]'. +tests/cases/conformance/functions/strictBindCallApply1.ts(71,17): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/functions/strictBindCallApply1.ts(72,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; + declare function overloaded(s: string): number; + declare function overloaded(n: number): string; + + declare function generic(x: T): T; + let f00 = foo.bind(undefined); let f01 = foo.bind(undefined, 10); let f02 = foo.bind(undefined, 10, "hello"); @@ -37,6 +42,9 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(57,12): error TS2345: ~~ !!! error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. + let f04 = overloaded.bind(undefined); // typeof overloaded + let f05 = generic.bind(undefined); // typeof generic + let c00 = foo.call(undefined, 10, "hello"); let c01 = foo.call(undefined, 10); // Error ~~~~~~~~~~~~~~~~~~~~~~~ @@ -65,6 +73,10 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(57,12): error TS2345: class C { constructor(a: number, b: string) {} foo(this: this, a: number, b: string): string { return "" } + overloaded(s: string): number; + overloaded(n: number): string; + overloaded(x: any): any { return undefined } + generic(x: T): T { return x } } declare let c: C; @@ -80,6 +92,9 @@ tests/cases/conformance/functions/strictBindCallApply1.ts(57,12): error TS2345: ~~~~~~~~~ !!! error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'C'. + let f15 = c.overloaded.bind(c); // typeof C.prototype.overloaded + let f16 = c.generic.bind(c); // typeof C.prototype.generic + let c10 = c.foo.call(c, 10, "hello"); let c11 = c.foo.call(c, 10); // Error ~~~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/strictBindCallApply1.js b/tests/baselines/reference/strictBindCallApply1.js index e43c84edbf133..fc90729a8d6a1 100644 --- a/tests/baselines/reference/strictBindCallApply1.js +++ b/tests/baselines/reference/strictBindCallApply1.js @@ -1,11 +1,19 @@ //// [strictBindCallApply1.ts] declare function foo(a: number, b: string): string; +declare function overloaded(s: string): number; +declare function overloaded(n: number): string; + +declare function generic(x: T): T; + 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 f04 = overloaded.bind(undefined); // typeof overloaded +let f05 = generic.bind(undefined); // typeof generic + let c00 = foo.call(undefined, 10, "hello"); let c01 = foo.call(undefined, 10); // Error let c02 = foo.call(undefined, 10, 20); // Error @@ -19,6 +27,10 @@ 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 "" } + overloaded(s: string): number; + overloaded(n: number): string; + overloaded(x: any): any { return undefined } + generic(x: T): T { return x } } declare let c: C; @@ -30,6 +42,9 @@ 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 f15 = c.overloaded.bind(c); // typeof C.prototype.overloaded +let f16 = c.generic.bind(c); // typeof C.prototype.generic + 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 @@ -64,6 +79,8 @@ 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 f04 = overloaded.bind(undefined); // typeof overloaded +var f05 = generic.bind(undefined); // typeof generic var c00 = foo.call(undefined, 10, "hello"); var c01 = foo.call(undefined, 10); // Error var c02 = foo.call(undefined, 10, 20); // Error @@ -76,6 +93,8 @@ var C = /** @class */ (function () { function C(a, b) { } C.prototype.foo = function (a, b) { return ""; }; + C.prototype.overloaded = function (x) { return undefined; }; + C.prototype.generic = function (x) { return x; }; return C; }()); var f10 = c.foo.bind(c); @@ -83,6 +102,8 @@ 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 f15 = c.overloaded.bind(c); // typeof C.prototype.overloaded +var f16 = c.generic.bind(c); // typeof C.prototype.generic 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 diff --git a/tests/baselines/reference/strictBindCallApply1.symbols b/tests/baselines/reference/strictBindCallApply1.symbols index b8133a65a78e4..705df6da69925 100644 --- a/tests/baselines/reference/strictBindCallApply1.symbols +++ b/tests/baselines/reference/strictBindCallApply1.symbols @@ -4,319 +4,387 @@ declare function foo(a: number, b: string): string; >a : Symbol(a, Decl(strictBindCallApply1.ts, 0, 21)) >b : Symbol(b, Decl(strictBindCallApply1.ts, 0, 31)) +declare function overloaded(s: string): number; +>overloaded : Symbol(overloaded, Decl(strictBindCallApply1.ts, 0, 51), Decl(strictBindCallApply1.ts, 2, 47)) +>s : Symbol(s, Decl(strictBindCallApply1.ts, 2, 28)) + +declare function overloaded(n: number): string; +>overloaded : Symbol(overloaded, Decl(strictBindCallApply1.ts, 0, 51), Decl(strictBindCallApply1.ts, 2, 47)) +>n : Symbol(n, Decl(strictBindCallApply1.ts, 3, 28)) + +declare function generic(x: T): T; +>generic : Symbol(generic, Decl(strictBindCallApply1.ts, 3, 47)) +>T : Symbol(T, Decl(strictBindCallApply1.ts, 5, 25)) +>x : Symbol(x, Decl(strictBindCallApply1.ts, 5, 28)) +>T : Symbol(T, Decl(strictBindCallApply1.ts, 5, 25)) +>T : Symbol(T, Decl(strictBindCallApply1.ts, 5, 25)) + let f00 = foo.bind(undefined); ->f00 : Symbol(f00, Decl(strictBindCallApply1.ts, 2, 3)) +>f00 : Symbol(f00, Decl(strictBindCallApply1.ts, 7, 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, --, --) ... and 1 more) >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, --, --) ... and 1 more) >undefined : Symbol(undefined) let f01 = foo.bind(undefined, 10); ->f01 : Symbol(f01, Decl(strictBindCallApply1.ts, 3, 3)) +>f01 : Symbol(f01, Decl(strictBindCallApply1.ts, 8, 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, --, --) ... and 1 more) >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, --, --) ... and 1 more) >undefined : Symbol(undefined) let f02 = foo.bind(undefined, 10, "hello"); ->f02 : Symbol(f02, Decl(strictBindCallApply1.ts, 4, 3)) +>f02 : Symbol(f02, Decl(strictBindCallApply1.ts, 9, 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, --, --) ... and 1 more) >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, --, --) ... and 1 more) >undefined : Symbol(undefined) let f03 = foo.bind(undefined, 10, 20); // Error ->f03 : Symbol(f03, Decl(strictBindCallApply1.ts, 5, 3)) +>f03 : Symbol(f03, Decl(strictBindCallApply1.ts, 10, 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, --, --) ... and 1 more) >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, --, --) ... and 1 more) >undefined : Symbol(undefined) +let f04 = overloaded.bind(undefined); // typeof overloaded +>f04 : Symbol(f04, Decl(strictBindCallApply1.ts, 12, 3)) +>overloaded.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, --, --) ... and 1 more) +>overloaded : Symbol(overloaded, Decl(strictBindCallApply1.ts, 0, 51), Decl(strictBindCallApply1.ts, 2, 47)) +>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, --, --) ... and 1 more) +>undefined : Symbol(undefined) + +let f05 = generic.bind(undefined); // typeof generic +>f05 : Symbol(f05, Decl(strictBindCallApply1.ts, 13, 3)) +>generic.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, --, --) ... and 1 more) +>generic : Symbol(generic, Decl(strictBindCallApply1.ts, 3, 47)) +>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, --, --) ... and 1 more) +>undefined : Symbol(undefined) + let c00 = foo.call(undefined, 10, "hello"); ->c00 : Symbol(c00, Decl(strictBindCallApply1.ts, 7, 3)) +>c00 : Symbol(c00, Decl(strictBindCallApply1.ts, 15, 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)) +>c01 : Symbol(c01, Decl(strictBindCallApply1.ts, 16, 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)) +>c02 : Symbol(c02, Decl(strictBindCallApply1.ts, 17, 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)) +>c03 : Symbol(c03, Decl(strictBindCallApply1.ts, 18, 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)) +>a00 : Symbol(a00, Decl(strictBindCallApply1.ts, 20, 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)) +>a01 : Symbol(a01, Decl(strictBindCallApply1.ts, 21, 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)) +>a02 : Symbol(a02, Decl(strictBindCallApply1.ts, 22, 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)) +>a03 : Symbol(a03, Decl(strictBindCallApply1.ts, 23, 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)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 23, 50)) constructor(a: number, b: string) {} ->a : Symbol(a, Decl(strictBindCallApply1.ts, 18, 16)) ->b : Symbol(b, Decl(strictBindCallApply1.ts, 18, 26)) +>a : Symbol(a, Decl(strictBindCallApply1.ts, 26, 16)) +>b : Symbol(b, Decl(strictBindCallApply1.ts, 26, 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)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) +>this : Symbol(this, Decl(strictBindCallApply1.ts, 27, 8)) +>a : Symbol(a, Decl(strictBindCallApply1.ts, 27, 19)) +>b : Symbol(b, Decl(strictBindCallApply1.ts, 27, 30)) + + overloaded(s: string): number; +>overloaded : Symbol(C.overloaded, Decl(strictBindCallApply1.ts, 27, 63), Decl(strictBindCallApply1.ts, 28, 34), Decl(strictBindCallApply1.ts, 29, 34)) +>s : Symbol(s, Decl(strictBindCallApply1.ts, 28, 15)) + + overloaded(n: number): string; +>overloaded : Symbol(C.overloaded, Decl(strictBindCallApply1.ts, 27, 63), Decl(strictBindCallApply1.ts, 28, 34), Decl(strictBindCallApply1.ts, 29, 34)) +>n : Symbol(n, Decl(strictBindCallApply1.ts, 29, 15)) + + overloaded(x: any): any { return undefined } +>overloaded : Symbol(C.overloaded, Decl(strictBindCallApply1.ts, 27, 63), Decl(strictBindCallApply1.ts, 28, 34), Decl(strictBindCallApply1.ts, 29, 34)) +>x : Symbol(x, Decl(strictBindCallApply1.ts, 30, 15)) +>undefined : Symbol(undefined) + + generic(x: T): T { return x } +>generic : Symbol(C.generic, Decl(strictBindCallApply1.ts, 30, 53)) +>T : Symbol(T, Decl(strictBindCallApply1.ts, 31, 12)) +>x : Symbol(x, Decl(strictBindCallApply1.ts, 31, 15)) +>T : Symbol(T, Decl(strictBindCallApply1.ts, 31, 12)) +>T : Symbol(T, Decl(strictBindCallApply1.ts, 31, 12)) +>x : Symbol(x, Decl(strictBindCallApply1.ts, 31, 15)) } declare let c: C; ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) ->C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 23, 50)) declare let obj: {}; ->obj : Symbol(obj, Decl(strictBindCallApply1.ts, 23, 11)) +>obj : Symbol(obj, Decl(strictBindCallApply1.ts, 35, 11)) let f10 = c.foo.bind(c); ->f10 : Symbol(f10, Decl(strictBindCallApply1.ts, 25, 3)) +>f10 : Symbol(f10, Decl(strictBindCallApply1.ts, 37, 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, --, --) ... and 1 more) ->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)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 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, --, --) ... and 1 more) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) let f11 = c.foo.bind(c, 10); ->f11 : Symbol(f11, Decl(strictBindCallApply1.ts, 26, 3)) +>f11 : Symbol(f11, Decl(strictBindCallApply1.ts, 38, 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, --, --) ... and 1 more) ->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)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 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, --, --) ... and 1 more) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) let f12 = c.foo.bind(c, 10, "hello"); ->f12 : Symbol(f12, Decl(strictBindCallApply1.ts, 27, 3)) +>f12 : Symbol(f12, Decl(strictBindCallApply1.ts, 39, 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, --, --) ... and 1 more) ->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)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 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, --, --) ... and 1 more) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) let f13 = c.foo.bind(c, 10, 20); // Error ->f13 : Symbol(f13, Decl(strictBindCallApply1.ts, 28, 3)) +>f13 : Symbol(f13, Decl(strictBindCallApply1.ts, 40, 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, --, --) ... and 1 more) ->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)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 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, --, --) ... and 1 more) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) let f14 = c.foo.bind(undefined); // Error ->f14 : Symbol(f14, Decl(strictBindCallApply1.ts, 29, 3)) +>f14 : Symbol(f14, Decl(strictBindCallApply1.ts, 41, 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, --, --) ... and 1 more) ->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)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 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, --, --) ... and 1 more) >undefined : Symbol(undefined) +let f15 = c.overloaded.bind(c); // typeof C.prototype.overloaded +>f15 : Symbol(f15, Decl(strictBindCallApply1.ts, 43, 3)) +>c.overloaded.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, --, --) ... and 1 more) +>c.overloaded : Symbol(C.overloaded, Decl(strictBindCallApply1.ts, 27, 63), Decl(strictBindCallApply1.ts, 28, 34), Decl(strictBindCallApply1.ts, 29, 34)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) +>overloaded : Symbol(C.overloaded, Decl(strictBindCallApply1.ts, 27, 63), Decl(strictBindCallApply1.ts, 28, 34), Decl(strictBindCallApply1.ts, 29, 34)) +>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, --, --) ... and 1 more) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) + +let f16 = c.generic.bind(c); // typeof C.prototype.generic +>f16 : Symbol(f16, Decl(strictBindCallApply1.ts, 44, 3)) +>c.generic.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, --, --) ... and 1 more) +>c.generic : Symbol(C.generic, Decl(strictBindCallApply1.ts, 30, 53)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) +>generic : Symbol(C.generic, Decl(strictBindCallApply1.ts, 30, 53)) +>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, --, --) ... and 1 more) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) + let c10 = c.foo.call(c, 10, "hello"); ->c10 : Symbol(c10, Decl(strictBindCallApply1.ts, 31, 3)) +>c10 : Symbol(c10, Decl(strictBindCallApply1.ts, 46, 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)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) >call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) let c11 = c.foo.call(c, 10); // Error ->c11 : Symbol(c11, Decl(strictBindCallApply1.ts, 32, 3)) +>c11 : Symbol(c11, Decl(strictBindCallApply1.ts, 47, 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)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) >call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) let c12 = c.foo.call(c, 10, 20); // Error ->c12 : Symbol(c12, Decl(strictBindCallApply1.ts, 33, 3)) +>c12 : Symbol(c12, Decl(strictBindCallApply1.ts, 48, 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)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) >call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) let c13 = c.foo.call(c, 10, "hello", 30); // Error ->c13 : Symbol(c13, Decl(strictBindCallApply1.ts, 34, 3)) +>c13 : Symbol(c13, Decl(strictBindCallApply1.ts, 49, 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)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) >call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) let c14 = c.foo.call(undefined, 10, "hello"); // Error ->c14 : Symbol(c14, Decl(strictBindCallApply1.ts, 35, 3)) +>c14 : Symbol(c14, Decl(strictBindCallApply1.ts, 50, 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)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 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)) +>a10 : Symbol(a10, Decl(strictBindCallApply1.ts, 52, 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)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) >apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) let a11 = c.foo.apply(c, [10]); // Error ->a11 : Symbol(a11, Decl(strictBindCallApply1.ts, 38, 3)) +>a11 : Symbol(a11, Decl(strictBindCallApply1.ts, 53, 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)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) >apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) let a12 = c.foo.apply(c, [10, 20]); // Error ->a12 : Symbol(a12, Decl(strictBindCallApply1.ts, 39, 3)) +>a12 : Symbol(a12, Decl(strictBindCallApply1.ts, 54, 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)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) >apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) let a13 = c.foo.apply(c, [10, "hello", 30]); // Error ->a13 : Symbol(a13, Decl(strictBindCallApply1.ts, 40, 3)) +>a13 : Symbol(a13, Decl(strictBindCallApply1.ts, 55, 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)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) >apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) let a14 = c.foo.apply(undefined, [10, "hello"]); // Error ->a14 : Symbol(a14, Decl(strictBindCallApply1.ts, 41, 3)) +>a14 : Symbol(a14, Decl(strictBindCallApply1.ts, 56, 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)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 26, 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)) +>f20 : Symbol(f20, Decl(strictBindCallApply1.ts, 58, 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, --, --) ... and 1 more) ->C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 23, 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, --, --) ... and 1 more) >undefined : Symbol(undefined) let f21 = C.bind(undefined, 10); ->f21 : Symbol(f21, Decl(strictBindCallApply1.ts, 44, 3)) +>f21 : Symbol(f21, Decl(strictBindCallApply1.ts, 59, 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, --, --) ... and 1 more) ->C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 23, 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, --, --) ... and 1 more) >undefined : Symbol(undefined) let f22 = C.bind(undefined, 10, "hello"); ->f22 : Symbol(f22, Decl(strictBindCallApply1.ts, 45, 3)) +>f22 : Symbol(f22, Decl(strictBindCallApply1.ts, 60, 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, --, --) ... and 1 more) ->C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 23, 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, --, --) ... and 1 more) >undefined : Symbol(undefined) let f23 = C.bind(undefined, 10, 20); // Error ->f23 : Symbol(f23, Decl(strictBindCallApply1.ts, 46, 3)) +>f23 : Symbol(f23, Decl(strictBindCallApply1.ts, 61, 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, --, --) ... and 1 more) ->C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 23, 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, --, --) ... and 1 more) >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)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 23, 50)) >call : Symbol(NewableFunction.call, Decl(lib.es5.d.ts, --, --)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) C.call(c, 10); // Error >C.call : Symbol(NewableFunction.call, Decl(lib.es5.d.ts, --, --)) ->C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 23, 50)) >call : Symbol(NewableFunction.call, Decl(lib.es5.d.ts, --, --)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 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)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 23, 50)) >call : Symbol(NewableFunction.call, Decl(lib.es5.d.ts, --, --)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 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)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 23, 50)) >call : Symbol(NewableFunction.call, Decl(lib.es5.d.ts, --, --)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 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)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 23, 50)) >apply : Symbol(NewableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 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)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 23, 50)) >apply : Symbol(NewableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 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)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 23, 50)) >apply : Symbol(NewableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 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)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 23, 50)) >apply : Symbol(NewableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 34, 11)) diff --git a/tests/baselines/reference/strictBindCallApply1.types b/tests/baselines/reference/strictBindCallApply1.types index eb859d722d84b..7237c1d3142f4 100644 --- a/tests/baselines/reference/strictBindCallApply1.types +++ b/tests/baselines/reference/strictBindCallApply1.types @@ -4,6 +4,18 @@ declare function foo(a: number, b: string): string; >a : number >b : string +declare function overloaded(s: string): number; +>overloaded : { (s: string): number; (n: number): string; } +>s : string + +declare function overloaded(n: number): string; +>overloaded : { (s: string): number; (n: number): string; } +>n : number + +declare function generic(x: T): T; +>generic : (x: T) => T +>x : T + let f00 = foo.bind(undefined); >f00 : (a: number, b: string) => string >foo.bind(undefined) : (a: number, b: string) => string @@ -41,6 +53,22 @@ let f03 = foo.bind(undefined, 10, 20); // Error >10 : 10 >20 : 20 +let f04 = overloaded.bind(undefined); // typeof overloaded +>f04 : { (s: string): number; (n: number): string; } +>overloaded.bind(undefined) : { (s: string): number; (n: number): string; } +>overloaded.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>overloaded : { (s: string): number; (n: number): string; } +>bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>undefined : undefined + +let f05 = generic.bind(undefined); // typeof generic +>f05 : (x: T) => T +>generic.bind(undefined) : (x: T) => T +>generic.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>generic : (x: T) => T +>bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>undefined : undefined + let c00 = foo.call(undefined, 10, "hello"); >c00 : string >foo.call(undefined, 10, "hello") : string @@ -138,6 +166,25 @@ class C { >a : number >b : string >"" : "" + + overloaded(s: string): number; +>overloaded : { (s: string): number; (n: number): string; } +>s : string + + overloaded(n: number): string; +>overloaded : { (s: string): number; (n: number): string; } +>n : number + + overloaded(x: any): any { return undefined } +>overloaded : { (s: string): number; (n: number): string; } +>x : any +>undefined : any +>undefined : undefined + + generic(x: T): T { return x } +>generic : (x: T) => T +>x : T +>x : T } declare let c: C; @@ -201,6 +248,26 @@ let f14 = c.foo.bind(undefined); // Error >bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } >undefined : undefined +let f15 = c.overloaded.bind(c); // typeof C.prototype.overloaded +>f15 : { (s: string): number; (n: number): string; } +>c.overloaded.bind(c) : { (s: string): number; (n: number): string; } +>c.overloaded.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>c.overloaded : { (s: string): number; (n: number): string; } +>c : C +>overloaded : { (s: string): number; (n: number): string; } +>bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>c : C + +let f16 = c.generic.bind(c); // typeof C.prototype.generic +>f16 : (x: T) => T +>c.generic.bind(c) : (x: T) => T +>c.generic.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>c.generic : (x: T) => T +>c : C +>generic : (x: T) => T +>bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (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; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>c : C + let c10 = c.foo.call(c, 10, "hello"); >c10 : string >c.foo.call(c, 10, "hello") : string