From 75ac22dd9e696ecb6451ef28e732568283418cfd Mon Sep 17 00:00:00 2001 From: Jack Bates Date: Tue, 27 Aug 2019 11:03:07 -0700 Subject: [PATCH] Better typings for Promise.then(), like #31117 --- src/lib/es5.d.ts | 6 +-- .../asyncFunctionDeclaration15_es5.errors.txt | 8 ++-- ...ionEmitExportAliasVisibiilityMarking.types | 4 +- .../reference/esModuleInteropImportCall.types | 4 +- .../reference/genericFunctionInference1.types | 4 +- .../importCallExpression1ESNext.types | 4 +- .../importCallExpression2ESNext.types | 4 +- .../importCallExpression4ESNext.types | 4 +- .../importCallExpressionES5AMD.types | 4 +- .../importCallExpressionES5CJS.types | 4 +- .../importCallExpressionES5System.types | 4 +- .../importCallExpressionES5UMD.types | 4 +- .../importCallExpressionES6AMD.types | 4 +- .../importCallExpressionES6CJS.types | 4 +- .../importCallExpressionES6UMD.types | 4 +- .../importCallExpressionErrorInES2015.types | 4 +- .../importCallExpressionInAMD1.types | 4 +- .../importCallExpressionInAMD2.types | 4 +- .../importCallExpressionInAMD4.types | 8 ++-- .../importCallExpressionInCJS1.types | 4 +- .../importCallExpressionInCJS3.types | 4 +- .../importCallExpressionInCJS5.types | 8 ++-- .../importCallExpressionInSystem1.types | 4 +- .../importCallExpressionInSystem2.types | 4 +- .../importCallExpressionInSystem4.types | 8 ++-- .../importCallExpressionInUMD1.types | 4 +- .../importCallExpressionInUMD2.types | 4 +- ...tCallExpressionNoModuleKindSpecified.types | 4 +- ...portCallExpressionReturnPromiseOfAny.types | 4 +- ...mportCallExpressionShouldNotGetParen.types | 8 ++-- ...xpressionSpecifierNotStringTypeError.types | 4 +- .../baselines/reference/inferenceLimit.types | 8 ++-- .../instantiateContextualTypes.types | 12 +++--- ...eLibrary_NoErrorDuplicateLibOptions1.types | 4 +- ...eLibrary_NoErrorDuplicateLibOptions2.types | 4 +- ...dularizeLibrary_TargetES5UsingES6Lib.types | 4 +- .../optionalFunctionArgAssignability.types | 2 +- tests/baselines/reference/promiseTest.types | 8 ++-- .../reference/promiseTypeInference.errors.txt | 40 ------------------- .../reference/promiseTypeInference.types | 10 ++--- .../reference/promiseVoidErrorCallback.types | 8 ++-- tests/baselines/reference/promises.types | 4 +- .../reference/promisesWithConstraints.types | 2 +- .../reference/specializationError.types | 2 +- ...eticDefaultExportsWithDynamicImports.types | 4 +- .../initial-build/resolves-correctly.js | 12 +++--- .../unionAndIntersectionInference1.types | 4 +- 47 files changed, 117 insertions(+), 157 deletions(-) delete mode 100644 tests/baselines/reference/promiseTypeInference.errors.txt diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index 3eced36c0778d..75cdb8b650158 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -1370,7 +1370,7 @@ interface PromiseLike { * @param onrejected The callback to execute when the Promise is rejected. * @returns A Promise for the completion of which ever callback is executed. */ - then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): PromiseLike; + then(onfulfilled?: ((value: T) => TResult1) | undefined | null, onrejected?: ((reason: any) => TResult2) | undefined | null): PromiseLike<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)>; } /** @@ -1383,14 +1383,14 @@ interface Promise { * @param onrejected The callback to execute when the Promise is rejected. * @returns A Promise for the completion of which ever callback is executed. */ - then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): Promise; + then(onfulfilled?: ((value: T) => TResult1) | undefined | null, onrejected?: ((reason: any) => TResult2) | undefined | null): Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)>; /** * Attaches a callback for only the rejection of the Promise. * @param onrejected The callback to execute when the Promise is rejected. * @returns A Promise for the completion of the callback. */ - catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): Promise; + catch(onrejected?: ((reason: any) => TResult) | undefined | null): Promise ? UResult : TResult)>; } interface ArrayLike { diff --git a/tests/baselines/reference/asyncFunctionDeclaration15_es5.errors.txt b/tests/baselines/reference/asyncFunctionDeclaration15_es5.errors.txt index 6b4b0a71c6fe1..98383b34f4277 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration15_es5.errors.txt +++ b/tests/baselines/reference/asyncFunctionDeclaration15_es5.errors.txt @@ -7,8 +7,8 @@ tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration1 tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration15_es5.ts(10,23): error TS1055: Type 'typeof Thenable' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value. Type 'Thenable' is not assignable to type 'PromiseLike'. Types of property 'then' are incompatible. - Type '() => void' is not assignable to type '(onfulfilled?: (value: T) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => PromiseLike'. - Type 'void' is not assignable to type 'PromiseLike'. + Type '() => void' is not assignable to type '(onfulfilled?: (value: T) => TResult1, onrejected?: (reason: any) => TResult2) => PromiseLike<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)>'. + Type 'void' is not assignable to type 'PromiseLike<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)>'. tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration15_es5.ts(17,16): error TS1058: The return type of an async function must either be a valid promise or must not contain a callable 'then' member. tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration15_es5.ts(23,25): error TS1320: Type of 'await' operand must either be a valid promise or must not contain a callable 'then' member. @@ -40,8 +40,8 @@ tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration1 !!! error TS1055: Type 'typeof Thenable' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value. !!! error TS1055: Type 'Thenable' is not assignable to type 'PromiseLike'. !!! error TS1055: Types of property 'then' are incompatible. -!!! error TS1055: Type '() => void' is not assignable to type '(onfulfilled?: (value: T) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => PromiseLike'. -!!! error TS1055: Type 'void' is not assignable to type 'PromiseLike'. +!!! error TS1055: Type '() => void' is not assignable to type '(onfulfilled?: (value: T) => TResult1, onrejected?: (reason: any) => TResult2) => PromiseLike<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)>'. +!!! error TS1055: Type 'void' is not assignable to type 'PromiseLike<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)>'. async function fn7() { return; } // valid: Promise async function fn8() { return 1; } // valid: Promise async function fn9() { return null; } // valid: Promise diff --git a/tests/baselines/reference/declarationEmitExportAliasVisibiilityMarking.types b/tests/baselines/reference/declarationEmitExportAliasVisibiilityMarking.types index bf9666f3082b1..29479073a6961 100644 --- a/tests/baselines/reference/declarationEmitExportAliasVisibiilityMarking.types +++ b/tests/baselines/reference/declarationEmitExportAliasVisibiilityMarking.types @@ -28,10 +28,10 @@ export let lazyCard = () => import('./Card').then(a => a.default); >lazyCard : () => Promise<(suit: import("tests/cases/compiler/Types").Suit, rank: import("tests/cases/compiler/Types").Rank) => { suit: import("tests/cases/compiler/Types").Suit; rank: import("tests/cases/compiler/Types").Rank; }> >() => import('./Card').then(a => a.default) : () => Promise<(suit: import("tests/cases/compiler/Types").Suit, rank: import("tests/cases/compiler/Types").Rank) => { suit: import("tests/cases/compiler/Types").Suit; rank: import("tests/cases/compiler/Types").Rank; }> >import('./Card').then(a => a.default) : Promise<(suit: import("tests/cases/compiler/Types").Suit, rank: import("tests/cases/compiler/Types").Rank) => { suit: import("tests/cases/compiler/Types").Suit; rank: import("tests/cases/compiler/Types").Rank; }> ->import('./Card').then : (onfulfilled?: (value: typeof import("tests/cases/compiler/Card")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>import('./Card').then : (onfulfilled?: (value: typeof import("tests/cases/compiler/Card")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >import('./Card') : Promise >'./Card' : "./Card" ->then : (onfulfilled?: (value: typeof import("tests/cases/compiler/Card")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : (onfulfilled?: (value: typeof import("tests/cases/compiler/Card")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >a => a.default : (a: typeof import("tests/cases/compiler/Card")) => (suit: import("tests/cases/compiler/Types").Suit, rank: import("tests/cases/compiler/Types").Rank) => { suit: import("tests/cases/compiler/Types").Suit; rank: import("tests/cases/compiler/Types").Rank; } >a : typeof import("tests/cases/compiler/Card") >a.default : (suit: import("tests/cases/compiler/Types").Suit, rank: import("tests/cases/compiler/Types").Rank) => { suit: import("tests/cases/compiler/Types").Suit; rank: import("tests/cases/compiler/Types").Rank; } diff --git a/tests/baselines/reference/esModuleInteropImportCall.types b/tests/baselines/reference/esModuleInteropImportCall.types index 59d1de3076822..cf708acd0aacf 100644 --- a/tests/baselines/reference/esModuleInteropImportCall.types +++ b/tests/baselines/reference/esModuleInteropImportCall.types @@ -9,10 +9,10 @@ export = foo; === tests/cases/compiler/index.ts === import("./foo").then(f => { >import("./foo").then(f => { f.default;}) : Promise ->import("./foo").then : void; }, TResult2 = never>(onfulfilled?: (value: { default: () => void; }) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>import("./foo").then : void; }, TResult2 = never>(onfulfilled?: (value: { default: () => void; }) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >import("./foo") : Promise<{ default: () => void; }> >"./foo" : "./foo" ->then : void; }, TResult2 = never>(onfulfilled?: (value: { default: () => void; }) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : void; }, TResult2 = never>(onfulfilled?: (value: { default: () => void; }) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >f => { f.default;} : (f: { default: () => void; }) => void >f : { default: () => void; } diff --git a/tests/baselines/reference/genericFunctionInference1.types b/tests/baselines/reference/genericFunctionInference1.types index 1974fe17bea80..4563e2be81e87 100644 --- a/tests/baselines/reference/genericFunctionInference1.types +++ b/tests/baselines/reference/genericFunctionInference1.types @@ -842,9 +842,9 @@ const promise = Promise.resolve(1); promise.then( >promise.then( pipe( x => x + 1, x => x * 2, ),) : Promise ->promise.then : (onfulfilled?: ((value: number) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>promise.then : (onfulfilled?: ((value: number) => TResult1) | null | undefined, onrejected?: ((reason: any) => TResult2) | null | undefined) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >promise : Promise ->then : (onfulfilled?: ((value: number) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>then : (onfulfilled?: ((value: number) => TResult1) | null | undefined, onrejected?: ((reason: any) => TResult2) | null | undefined) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> pipe( >pipe( x => x + 1, x => x * 2, ) : (x: number) => number diff --git a/tests/baselines/reference/importCallExpression1ESNext.types b/tests/baselines/reference/importCallExpression1ESNext.types index 30fe9acd605ea..25b466b864094 100644 --- a/tests/baselines/reference/importCallExpression1ESNext.types +++ b/tests/baselines/reference/importCallExpression1ESNext.types @@ -15,9 +15,9 @@ var p1 = import("./0"); p1.then(zero => { >p1.then(zero => { return zero.foo();}) : Promise ->p1.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p1.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >p1 : Promise ->then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >zero => { return zero.foo();} : (zero: typeof import("tests/cases/conformance/dynamicImport/0")) => string >zero : typeof import("tests/cases/conformance/dynamicImport/0") diff --git a/tests/baselines/reference/importCallExpression2ESNext.types b/tests/baselines/reference/importCallExpression2ESNext.types index 80580e35d5362..b9c29014a2028 100644 --- a/tests/baselines/reference/importCallExpression2ESNext.types +++ b/tests/baselines/reference/importCallExpression2ESNext.types @@ -14,9 +14,9 @@ function foo(x: Promise) { x.then(value => { >x.then(value => { let b = new value.B(); b.print(); }) : Promise ->x.then : (onfulfilled?: (value: any) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>x.then : (onfulfilled?: (value: any) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >x : Promise ->then : (onfulfilled?: (value: any) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : (onfulfilled?: (value: any) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >value => { let b = new value.B(); b.print(); } : (value: any) => void >value : any diff --git a/tests/baselines/reference/importCallExpression4ESNext.types b/tests/baselines/reference/importCallExpression4ESNext.types index 82ddbf1db6571..94dd71c4ce1c3 100644 --- a/tests/baselines/reference/importCallExpression4ESNext.types +++ b/tests/baselines/reference/importCallExpression4ESNext.types @@ -38,11 +38,11 @@ class C { this.myModule.then(Zero => { >this.myModule.then(Zero => { console.log(Zero.foo()); }, async err => { console.log(err); let one = await import("./1"); console.log(one.backup()); }) : Promise ->this.myModule.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>this.myModule.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >this.myModule : Promise >this : this >myModule : Promise ->then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >Zero => { console.log(Zero.foo()); } : (Zero: typeof import("tests/cases/conformance/dynamicImport/0")) => void >Zero : typeof import("tests/cases/conformance/dynamicImport/0") diff --git a/tests/baselines/reference/importCallExpressionES5AMD.types b/tests/baselines/reference/importCallExpressionES5AMD.types index ceb6a6fe29962..87b4fa917a4b3 100644 --- a/tests/baselines/reference/importCallExpressionES5AMD.types +++ b/tests/baselines/reference/importCallExpressionES5AMD.types @@ -15,9 +15,9 @@ var p1 = import("./0"); p1.then(zero => { >p1.then(zero => { return zero.foo();}) : Promise ->p1.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p1.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >p1 : Promise ->then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >zero => { return zero.foo();} : (zero: typeof import("tests/cases/conformance/dynamicImport/0")) => string >zero : typeof import("tests/cases/conformance/dynamicImport/0") diff --git a/tests/baselines/reference/importCallExpressionES5CJS.types b/tests/baselines/reference/importCallExpressionES5CJS.types index ceb6a6fe29962..87b4fa917a4b3 100644 --- a/tests/baselines/reference/importCallExpressionES5CJS.types +++ b/tests/baselines/reference/importCallExpressionES5CJS.types @@ -15,9 +15,9 @@ var p1 = import("./0"); p1.then(zero => { >p1.then(zero => { return zero.foo();}) : Promise ->p1.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p1.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >p1 : Promise ->then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >zero => { return zero.foo();} : (zero: typeof import("tests/cases/conformance/dynamicImport/0")) => string >zero : typeof import("tests/cases/conformance/dynamicImport/0") diff --git a/tests/baselines/reference/importCallExpressionES5System.types b/tests/baselines/reference/importCallExpressionES5System.types index ceb6a6fe29962..87b4fa917a4b3 100644 --- a/tests/baselines/reference/importCallExpressionES5System.types +++ b/tests/baselines/reference/importCallExpressionES5System.types @@ -15,9 +15,9 @@ var p1 = import("./0"); p1.then(zero => { >p1.then(zero => { return zero.foo();}) : Promise ->p1.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p1.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >p1 : Promise ->then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >zero => { return zero.foo();} : (zero: typeof import("tests/cases/conformance/dynamicImport/0")) => string >zero : typeof import("tests/cases/conformance/dynamicImport/0") diff --git a/tests/baselines/reference/importCallExpressionES5UMD.types b/tests/baselines/reference/importCallExpressionES5UMD.types index ceb6a6fe29962..87b4fa917a4b3 100644 --- a/tests/baselines/reference/importCallExpressionES5UMD.types +++ b/tests/baselines/reference/importCallExpressionES5UMD.types @@ -15,9 +15,9 @@ var p1 = import("./0"); p1.then(zero => { >p1.then(zero => { return zero.foo();}) : Promise ->p1.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p1.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >p1 : Promise ->then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >zero => { return zero.foo();} : (zero: typeof import("tests/cases/conformance/dynamicImport/0")) => string >zero : typeof import("tests/cases/conformance/dynamicImport/0") diff --git a/tests/baselines/reference/importCallExpressionES6AMD.types b/tests/baselines/reference/importCallExpressionES6AMD.types index ceb6a6fe29962..87b4fa917a4b3 100644 --- a/tests/baselines/reference/importCallExpressionES6AMD.types +++ b/tests/baselines/reference/importCallExpressionES6AMD.types @@ -15,9 +15,9 @@ var p1 = import("./0"); p1.then(zero => { >p1.then(zero => { return zero.foo();}) : Promise ->p1.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p1.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >p1 : Promise ->then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >zero => { return zero.foo();} : (zero: typeof import("tests/cases/conformance/dynamicImport/0")) => string >zero : typeof import("tests/cases/conformance/dynamicImport/0") diff --git a/tests/baselines/reference/importCallExpressionES6CJS.types b/tests/baselines/reference/importCallExpressionES6CJS.types index ceb6a6fe29962..87b4fa917a4b3 100644 --- a/tests/baselines/reference/importCallExpressionES6CJS.types +++ b/tests/baselines/reference/importCallExpressionES6CJS.types @@ -15,9 +15,9 @@ var p1 = import("./0"); p1.then(zero => { >p1.then(zero => { return zero.foo();}) : Promise ->p1.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p1.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >p1 : Promise ->then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >zero => { return zero.foo();} : (zero: typeof import("tests/cases/conformance/dynamicImport/0")) => string >zero : typeof import("tests/cases/conformance/dynamicImport/0") diff --git a/tests/baselines/reference/importCallExpressionES6UMD.types b/tests/baselines/reference/importCallExpressionES6UMD.types index ceb6a6fe29962..87b4fa917a4b3 100644 --- a/tests/baselines/reference/importCallExpressionES6UMD.types +++ b/tests/baselines/reference/importCallExpressionES6UMD.types @@ -15,9 +15,9 @@ var p1 = import("./0"); p1.then(zero => { >p1.then(zero => { return zero.foo();}) : Promise ->p1.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p1.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >p1 : Promise ->then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >zero => { return zero.foo();} : (zero: typeof import("tests/cases/conformance/dynamicImport/0")) => string >zero : typeof import("tests/cases/conformance/dynamicImport/0") diff --git a/tests/baselines/reference/importCallExpressionErrorInES2015.types b/tests/baselines/reference/importCallExpressionErrorInES2015.types index f0a055e7a0626..06b90cb346bc3 100644 --- a/tests/baselines/reference/importCallExpressionErrorInES2015.types +++ b/tests/baselines/reference/importCallExpressionErrorInES2015.types @@ -15,9 +15,9 @@ var p1 = import("./0"); p1.then(zero => { >p1.then(zero => { return zero.foo();}) : Promise ->p1.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p1.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >p1 : Promise ->then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >zero => { return zero.foo();} : (zero: typeof import("tests/cases/conformance/dynamicImport/0")) => string >zero : typeof import("tests/cases/conformance/dynamicImport/0") diff --git a/tests/baselines/reference/importCallExpressionInAMD1.types b/tests/baselines/reference/importCallExpressionInAMD1.types index 6d270e686edf2..90531faaac5de 100644 --- a/tests/baselines/reference/importCallExpressionInAMD1.types +++ b/tests/baselines/reference/importCallExpressionInAMD1.types @@ -15,9 +15,9 @@ var p1 = import("./0"); p1.then(zero => { >p1.then(zero => { return zero.foo();}) : Promise ->p1.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p1.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >p1 : Promise ->then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >zero => { return zero.foo();} : (zero: typeof import("tests/cases/conformance/dynamicImport/0")) => string >zero : typeof import("tests/cases/conformance/dynamicImport/0") diff --git a/tests/baselines/reference/importCallExpressionInAMD2.types b/tests/baselines/reference/importCallExpressionInAMD2.types index 875118acbac1a..07f5caa812140 100644 --- a/tests/baselines/reference/importCallExpressionInAMD2.types +++ b/tests/baselines/reference/importCallExpressionInAMD2.types @@ -15,9 +15,9 @@ function foo(x: Promise) { x.then(value => { >x.then(value => { let b = new value.B(); b.print(); }) : Promise ->x.then : (onfulfilled?: (value: any) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>x.then : (onfulfilled?: (value: any) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >x : Promise ->then : (onfulfilled?: (value: any) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : (onfulfilled?: (value: any) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >value => { let b = new value.B(); b.print(); } : (value: any) => void >value : any diff --git a/tests/baselines/reference/importCallExpressionInAMD4.types b/tests/baselines/reference/importCallExpressionInAMD4.types index afedd6f4b815f..d0fc91bb1a1b2 100644 --- a/tests/baselines/reference/importCallExpressionInAMD4.types +++ b/tests/baselines/reference/importCallExpressionInAMD4.types @@ -38,11 +38,11 @@ class C { this.myModule.then(Zero => { >this.myModule.then(Zero => { console.log(Zero.foo()); }, async err => { console.log(err); let one = await import("./1"); console.log(one.backup()); }) : Promise ->this.myModule.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>this.myModule.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >this.myModule : Promise >this : this >myModule : Promise ->then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >Zero => { console.log(Zero.foo()); } : (Zero: typeof import("tests/cases/conformance/dynamicImport/0")) => void >Zero : typeof import("tests/cases/conformance/dynamicImport/0") @@ -105,11 +105,11 @@ export class D { this.myModule.then(Zero => { >this.myModule.then(Zero => { console.log(Zero.foo()); }, async err => { console.log(err); let one = await import("./1"); console.log(one.backup()); }) : Promise ->this.myModule.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>this.myModule.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >this.myModule : Promise >this : this >myModule : Promise ->then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >Zero => { console.log(Zero.foo()); } : (Zero: typeof import("tests/cases/conformance/dynamicImport/0")) => void >Zero : typeof import("tests/cases/conformance/dynamicImport/0") diff --git a/tests/baselines/reference/importCallExpressionInCJS1.types b/tests/baselines/reference/importCallExpressionInCJS1.types index 6d270e686edf2..90531faaac5de 100644 --- a/tests/baselines/reference/importCallExpressionInCJS1.types +++ b/tests/baselines/reference/importCallExpressionInCJS1.types @@ -15,9 +15,9 @@ var p1 = import("./0"); p1.then(zero => { >p1.then(zero => { return zero.foo();}) : Promise ->p1.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p1.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >p1 : Promise ->then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >zero => { return zero.foo();} : (zero: typeof import("tests/cases/conformance/dynamicImport/0")) => string >zero : typeof import("tests/cases/conformance/dynamicImport/0") diff --git a/tests/baselines/reference/importCallExpressionInCJS3.types b/tests/baselines/reference/importCallExpressionInCJS3.types index 875118acbac1a..07f5caa812140 100644 --- a/tests/baselines/reference/importCallExpressionInCJS3.types +++ b/tests/baselines/reference/importCallExpressionInCJS3.types @@ -15,9 +15,9 @@ function foo(x: Promise) { x.then(value => { >x.then(value => { let b = new value.B(); b.print(); }) : Promise ->x.then : (onfulfilled?: (value: any) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>x.then : (onfulfilled?: (value: any) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >x : Promise ->then : (onfulfilled?: (value: any) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : (onfulfilled?: (value: any) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >value => { let b = new value.B(); b.print(); } : (value: any) => void >value : any diff --git a/tests/baselines/reference/importCallExpressionInCJS5.types b/tests/baselines/reference/importCallExpressionInCJS5.types index aea65c1407070..823c0c4dec5fd 100644 --- a/tests/baselines/reference/importCallExpressionInCJS5.types +++ b/tests/baselines/reference/importCallExpressionInCJS5.types @@ -38,11 +38,11 @@ class C { this.myModule.then(Zero => { >this.myModule.then(Zero => { console.log(Zero.foo()); }, async err => { console.log(err); let one = await import("./1"); console.log(one.backup()); }) : Promise ->this.myModule.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>this.myModule.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >this.myModule : Promise >this : this >myModule : Promise ->then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >Zero => { console.log(Zero.foo()); } : (Zero: typeof import("tests/cases/conformance/dynamicImport/0")) => void >Zero : typeof import("tests/cases/conformance/dynamicImport/0") @@ -105,11 +105,11 @@ export class D { this.myModule.then(Zero => { >this.myModule.then(Zero => { console.log(Zero.foo()); }, async err => { console.log(err); let one = await import("./1"); console.log(one.backup()); }) : Promise ->this.myModule.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>this.myModule.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >this.myModule : Promise >this : this >myModule : Promise ->then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >Zero => { console.log(Zero.foo()); } : (Zero: typeof import("tests/cases/conformance/dynamicImport/0")) => void >Zero : typeof import("tests/cases/conformance/dynamicImport/0") diff --git a/tests/baselines/reference/importCallExpressionInSystem1.types b/tests/baselines/reference/importCallExpressionInSystem1.types index 6d270e686edf2..90531faaac5de 100644 --- a/tests/baselines/reference/importCallExpressionInSystem1.types +++ b/tests/baselines/reference/importCallExpressionInSystem1.types @@ -15,9 +15,9 @@ var p1 = import("./0"); p1.then(zero => { >p1.then(zero => { return zero.foo();}) : Promise ->p1.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p1.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >p1 : Promise ->then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >zero => { return zero.foo();} : (zero: typeof import("tests/cases/conformance/dynamicImport/0")) => string >zero : typeof import("tests/cases/conformance/dynamicImport/0") diff --git a/tests/baselines/reference/importCallExpressionInSystem2.types b/tests/baselines/reference/importCallExpressionInSystem2.types index 875118acbac1a..07f5caa812140 100644 --- a/tests/baselines/reference/importCallExpressionInSystem2.types +++ b/tests/baselines/reference/importCallExpressionInSystem2.types @@ -15,9 +15,9 @@ function foo(x: Promise) { x.then(value => { >x.then(value => { let b = new value.B(); b.print(); }) : Promise ->x.then : (onfulfilled?: (value: any) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>x.then : (onfulfilled?: (value: any) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >x : Promise ->then : (onfulfilled?: (value: any) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : (onfulfilled?: (value: any) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >value => { let b = new value.B(); b.print(); } : (value: any) => void >value : any diff --git a/tests/baselines/reference/importCallExpressionInSystem4.types b/tests/baselines/reference/importCallExpressionInSystem4.types index afedd6f4b815f..d0fc91bb1a1b2 100644 --- a/tests/baselines/reference/importCallExpressionInSystem4.types +++ b/tests/baselines/reference/importCallExpressionInSystem4.types @@ -38,11 +38,11 @@ class C { this.myModule.then(Zero => { >this.myModule.then(Zero => { console.log(Zero.foo()); }, async err => { console.log(err); let one = await import("./1"); console.log(one.backup()); }) : Promise ->this.myModule.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>this.myModule.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >this.myModule : Promise >this : this >myModule : Promise ->then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >Zero => { console.log(Zero.foo()); } : (Zero: typeof import("tests/cases/conformance/dynamicImport/0")) => void >Zero : typeof import("tests/cases/conformance/dynamicImport/0") @@ -105,11 +105,11 @@ export class D { this.myModule.then(Zero => { >this.myModule.then(Zero => { console.log(Zero.foo()); }, async err => { console.log(err); let one = await import("./1"); console.log(one.backup()); }) : Promise ->this.myModule.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>this.myModule.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >this.myModule : Promise >this : this >myModule : Promise ->then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >Zero => { console.log(Zero.foo()); } : (Zero: typeof import("tests/cases/conformance/dynamicImport/0")) => void >Zero : typeof import("tests/cases/conformance/dynamicImport/0") diff --git a/tests/baselines/reference/importCallExpressionInUMD1.types b/tests/baselines/reference/importCallExpressionInUMD1.types index 6d270e686edf2..90531faaac5de 100644 --- a/tests/baselines/reference/importCallExpressionInUMD1.types +++ b/tests/baselines/reference/importCallExpressionInUMD1.types @@ -15,9 +15,9 @@ var p1 = import("./0"); p1.then(zero => { >p1.then(zero => { return zero.foo();}) : Promise ->p1.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p1.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >p1 : Promise ->then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >zero => { return zero.foo();} : (zero: typeof import("tests/cases/conformance/dynamicImport/0")) => string >zero : typeof import("tests/cases/conformance/dynamicImport/0") diff --git a/tests/baselines/reference/importCallExpressionInUMD2.types b/tests/baselines/reference/importCallExpressionInUMD2.types index 875118acbac1a..07f5caa812140 100644 --- a/tests/baselines/reference/importCallExpressionInUMD2.types +++ b/tests/baselines/reference/importCallExpressionInUMD2.types @@ -15,9 +15,9 @@ function foo(x: Promise) { x.then(value => { >x.then(value => { let b = new value.B(); b.print(); }) : Promise ->x.then : (onfulfilled?: (value: any) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>x.then : (onfulfilled?: (value: any) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >x : Promise ->then : (onfulfilled?: (value: any) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : (onfulfilled?: (value: any) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >value => { let b = new value.B(); b.print(); } : (value: any) => void >value : any diff --git a/tests/baselines/reference/importCallExpressionNoModuleKindSpecified.types b/tests/baselines/reference/importCallExpressionNoModuleKindSpecified.types index ef8cdaec2fa72..e8a056be625cf 100644 --- a/tests/baselines/reference/importCallExpressionNoModuleKindSpecified.types +++ b/tests/baselines/reference/importCallExpressionNoModuleKindSpecified.types @@ -38,11 +38,11 @@ class C { this.myModule.then(Zero => { >this.myModule.then(Zero => { console.log(Zero.foo()); }, async err => { console.log(err); let one = await import("./1"); console.log(one.backup()); }) : Promise ->this.myModule.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>this.myModule.then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >this.myModule : Promise >this : this >myModule : Promise ->then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : (onfulfilled?: (value: typeof import("tests/cases/conformance/dynamicImport/0")) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >Zero => { console.log(Zero.foo()); } : (Zero: typeof import("tests/cases/conformance/dynamicImport/0")) => void >Zero : typeof import("tests/cases/conformance/dynamicImport/0") diff --git a/tests/baselines/reference/importCallExpressionReturnPromiseOfAny.types b/tests/baselines/reference/importCallExpressionReturnPromiseOfAny.types index b5f526adc8e89..0f7db097e253d 100644 --- a/tests/baselines/reference/importCallExpressionReturnPromiseOfAny.types +++ b/tests/baselines/reference/importCallExpressionReturnPromiseOfAny.types @@ -66,9 +66,9 @@ const p2 = import(whatToLoad ? getSpecifier() : "defaulPath") as Promise { >p1.then(zero => { return zero.foo(); // ok, zero is any}) : Promise ->p1.then : (onfulfilled?: (value: any) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p1.then : (onfulfilled?: (value: any) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >p1 : Promise ->then : (onfulfilled?: (value: any) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : (onfulfilled?: (value: any) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >zero => { return zero.foo(); // ok, zero is any} : (zero: any) => any >zero : any diff --git a/tests/baselines/reference/importCallExpressionShouldNotGetParen.types b/tests/baselines/reference/importCallExpressionShouldNotGetParen.types index 3e4001dc5b710..43f9a9b384db9 100644 --- a/tests/baselines/reference/importCallExpressionShouldNotGetParen.types +++ b/tests/baselines/reference/importCallExpressionShouldNotGetParen.types @@ -5,11 +5,11 @@ const localeName = "zh-CN"; import(`./locales/${localeName}.js`).then(bar => { >import(`./locales/${localeName}.js`).then(bar => { let x = bar;}) : Promise ->import(`./locales/${localeName}.js`).then : (onfulfilled?: (value: any) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>import(`./locales/${localeName}.js`).then : (onfulfilled?: (value: any) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >import(`./locales/${localeName}.js`) : Promise >`./locales/${localeName}.js` : string >localeName : "zh-CN" ->then : (onfulfilled?: (value: any) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : (onfulfilled?: (value: any) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >bar => { let x = bar;} : (bar: any) => void >bar : any @@ -21,14 +21,14 @@ import(`./locales/${localeName}.js`).then(bar => { import("./locales/" + localeName + ".js").then(bar => { >import("./locales/" + localeName + ".js").then(bar => { let x = bar;}) : Promise ->import("./locales/" + localeName + ".js").then : (onfulfilled?: (value: any) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>import("./locales/" + localeName + ".js").then : (onfulfilled?: (value: any) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >import("./locales/" + localeName + ".js") : Promise >"./locales/" + localeName + ".js" : string >"./locales/" + localeName : string >"./locales/" : "./locales/" >localeName : "zh-CN" >".js" : ".js" ->then : (onfulfilled?: (value: any) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : (onfulfilled?: (value: any) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >bar => { let x = bar;} : (bar: any) => void >bar : any diff --git a/tests/baselines/reference/importCallExpressionSpecifierNotStringTypeError.types b/tests/baselines/reference/importCallExpressionSpecifierNotStringTypeError.types index 6378e7c582be8..6b9d010138587 100644 --- a/tests/baselines/reference/importCallExpressionSpecifierNotStringTypeError.types +++ b/tests/baselines/reference/importCallExpressionSpecifierNotStringTypeError.types @@ -28,9 +28,9 @@ const p2 = import(whatToLoad ? getSpecifier() : "defaulPath") p1.then(zero => { >p1.then(zero => { return zero.foo(); // ok, zero is any}) : Promise ->p1.then : (onfulfilled?: (value: any) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>p1.then : (onfulfilled?: (value: any) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >p1 : Promise ->then : (onfulfilled?: (value: any) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : (onfulfilled?: (value: any) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >zero => { return zero.foo(); // ok, zero is any} : (zero: any) => any >zero : any diff --git a/tests/baselines/reference/inferenceLimit.types b/tests/baselines/reference/inferenceLimit.types index 6aa7ab501ea16..7e46a2679c29c 100644 --- a/tests/baselines/reference/inferenceLimit.types +++ b/tests/baselines/reference/inferenceLimit.types @@ -42,7 +42,7 @@ export class BrokenClass { this.doStuff(order.id) >this.doStuff(order.id) .then((items) => { order.items = items; resolve(order); }) : Promise ->this.doStuff(order.id) .then : (onfulfilled?: (value: void) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>this.doStuff(order.id) .then : (onfulfilled?: (value: void) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >this.doStuff(order.id) : Promise >this.doStuff : (id: number) => Promise >this : this @@ -52,7 +52,7 @@ export class BrokenClass { >id : any .then((items) => { ->then : (onfulfilled?: (value: void) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : (onfulfilled?: (value: void) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >(items) => { order.items = items; resolve(order); } : (items: void) => void >items : void @@ -74,7 +74,7 @@ export class BrokenClass { return Promise.all(result.map(populateItems)) >Promise.all(result.map(populateItems)) .then((orders: Array) => { resolve(orders); }) : Promise ->Promise.all(result.map(populateItems)) .then : (onfulfilled?: (value: unknown[]) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>Promise.all(result.map(populateItems)) .then : (onfulfilled?: (value: unknown[]) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >Promise.all(result.map(populateItems)) : Promise >Promise.all : { (values: Iterable>): Promise; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike]): Promise<[T1, T2, T3, T4]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; (values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; (values: (T | PromiseLike)[]): Promise; } >Promise : PromiseConstructor @@ -86,7 +86,7 @@ export class BrokenClass { >populateItems : (order: any) => Promise .then((orders: Array) => { ->then : (onfulfilled?: (value: unknown[]) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : (onfulfilled?: (value: unknown[]) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >(orders: Array) => { resolve(orders); } : (orders: MyModule.MyModel[]) => void >orders : MyModule.MyModel[] >MyModule : any diff --git a/tests/baselines/reference/instantiateContextualTypes.types b/tests/baselines/reference/instantiateContextualTypes.types index b5317b6f7561f..f0a94d52fef2a 100644 --- a/tests/baselines/reference/instantiateContextualTypes.types +++ b/tests/baselines/reference/instantiateContextualTypes.types @@ -340,12 +340,12 @@ class Interesting { return Promise.resolve().then(() => { >Promise.resolve().then(() => { if (1 < 2) { return 'SOMETHING'; } return 'ELSE'; }) : Promise ->Promise.resolve().then : (onfulfilled?: ((value: void) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>Promise.resolve().then : (onfulfilled?: ((value: void) => TResult1) | null | undefined, onrejected?: ((reason: any) => TResult2) | null | undefined) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >Promise.resolve() : Promise >Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } >Promise : PromiseConstructor >resolve : { (value: T | PromiseLike): Promise; (): Promise; } ->then : (onfulfilled?: ((value: void) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>then : (onfulfilled?: ((value: void) => TResult1) | null | undefined, onrejected?: ((reason: any) => TResult2) | null | undefined) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >() => { if (1 < 2) { return 'SOMETHING'; } return 'ELSE'; } : () => "SOMETHING" | "ELSE" if (1 < 2) { @@ -367,12 +367,12 @@ class Interesting { return Promise.resolve().then(() => { >Promise.resolve().then(() => { return 'ELSE'; }) : Promise ->Promise.resolve().then : (onfulfilled?: ((value: void) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>Promise.resolve().then : (onfulfilled?: ((value: void) => TResult1) | null | undefined, onrejected?: ((reason: any) => TResult2) | null | undefined) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >Promise.resolve() : Promise >Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } >Promise : PromiseConstructor >resolve : { (value: T | PromiseLike): Promise; (): Promise; } ->then : (onfulfilled?: ((value: void) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>then : (onfulfilled?: ((value: void) => TResult1) | null | undefined, onrejected?: ((reason: any) => TResult2) | null | undefined) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >() => { return 'ELSE'; } : () => "ELSE" return 'ELSE'; @@ -386,12 +386,12 @@ class Interesting { return Promise.resolve().then(() => { >Promise.resolve().then(() => { if (1 < 2) { return 'SOMETHING'; } return 'SOMETHING'; }) : Promise ->Promise.resolve().then : (onfulfilled?: ((value: void) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>Promise.resolve().then : (onfulfilled?: ((value: void) => TResult1) | null | undefined, onrejected?: ((reason: any) => TResult2) | null | undefined) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >Promise.resolve() : Promise >Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } >Promise : PromiseConstructor >resolve : { (value: T | PromiseLike): Promise; (): Promise; } ->then : (onfulfilled?: ((value: void) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise +>then : (onfulfilled?: ((value: void) => TResult1) | null | undefined, onrejected?: ((reason: any) => TResult2) | null | undefined) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >() => { if (1 < 2) { return 'SOMETHING'; } return 'SOMETHING'; } : () => "SOMETHING" if (1 < 2) { diff --git a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.types b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.types index c9a0476c2adcf..2bc1e64f87489 100644 --- a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.types +++ b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.types @@ -148,10 +148,10 @@ declare var console: any; out().then(() => { >out().then(() => { console.log("Yea!");}) : Promise ->out().then : (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>out().then : (onfulfilled?: (value: unknown) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >out() : Promise >out : () => Promise ->then : (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : (onfulfilled?: (value: unknown) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >() => { console.log("Yea!");} : () => void console.log("Yea!"); diff --git a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.types b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.types index a695213a42ccd..6653f64a44c88 100644 --- a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.types +++ b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.types @@ -148,10 +148,10 @@ declare var console: any; out().then(() => { >out().then(() => { console.log("Yea!");}) : Promise ->out().then : (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>out().then : (onfulfilled?: (value: unknown) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >out() : Promise >out : () => Promise ->then : (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : (onfulfilled?: (value: unknown) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >() => { console.log("Yea!");} : () => void console.log("Yea!"); diff --git a/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.types b/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.types index 3e7c23fde87ac..b5bab1c2e1a52 100644 --- a/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.types +++ b/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.types @@ -148,10 +148,10 @@ declare var console: any; out().then(() => { >out().then(() => { console.log("Yea!");}) : Promise ->out().then : (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>out().then : (onfulfilled?: (value: unknown) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >out() : Promise >out : () => Promise ->then : (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : (onfulfilled?: (value: unknown) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >() => { console.log("Yea!");} : () => void console.log("Yea!"); diff --git a/tests/baselines/reference/optionalFunctionArgAssignability.types b/tests/baselines/reference/optionalFunctionArgAssignability.types index a1975cc3645e0..acca19b7f6767 100644 --- a/tests/baselines/reference/optionalFunctionArgAssignability.types +++ b/tests/baselines/reference/optionalFunctionArgAssignability.types @@ -1,7 +1,7 @@ === tests/cases/compiler/optionalFunctionArgAssignability.ts === interface Promise { then(onFulfill?: (value: T) => U, onReject?: (reason: any) => U): Promise; ->then : { (onfulfilled?: (value: T) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (onFulfill?: (value: T) => U, onReject?: (reason: any) => U): Promise; } +>then : { (onfulfilled?: (value: T) => TResult1, onrejected?: (reason: any) => TResult2): Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)>; (onFulfill?: (value: T) => U, onReject?: (reason: any) => U): Promise; } >onFulfill : (value: T) => U >value : T >onReject : (reason: any) => U diff --git a/tests/baselines/reference/promiseTest.types b/tests/baselines/reference/promiseTest.types index 3d250c11c1f87..9d13486017512 100644 --- a/tests/baselines/reference/promiseTest.types +++ b/tests/baselines/reference/promiseTest.types @@ -1,12 +1,12 @@ === tests/cases/compiler/promiseTest.ts === interface Promise { then(success?: (value: T) => Promise): Promise; ->then : { (onfulfilled?: (value: T) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: T) => Promise): Promise; (success?: (value: T) => B): Promise; } +>then : { (onfulfilled?: (value: T) => TResult1, onrejected?: (reason: any) => TResult2): Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)>; (success?: (value: T) => Promise): Promise; (success?: (value: T) => B): Promise; } >success : (value: T) => Promise >value : T then(success?: (value: T) => B): Promise; ->then : { (onfulfilled?: (value: T) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: T) => Promise): Promise; (success?: (value: T) => B): Promise; } +>then : { (onfulfilled?: (value: T) => TResult1, onrejected?: (reason: any) => TResult2): Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)>; (success?: (value: T) => Promise): Promise; (success?: (value: T) => B): Promise; } >success : (value: T) => B >value : T @@ -21,9 +21,9 @@ var p: Promise = null; var p2 = p.then(function (x) { >p2 : Promise >p.then(function (x) { return p;} ) : Promise ->p.then : { (onfulfilled?: (value: number) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: number) => Promise): Promise; (success?: (value: number) => B): Promise; } +>p.then : { (onfulfilled?: (value: number) => TResult1, onrejected?: (reason: any) => TResult2): Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)>; (success?: (value: number) => Promise): Promise; (success?: (value: number) => B): Promise; } >p : Promise ->then : { (onfulfilled?: (value: number) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: number) => Promise): Promise; (success?: (value: number) => B): Promise; } +>then : { (onfulfilled?: (value: number) => TResult1, onrejected?: (reason: any) => TResult2): Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)>; (success?: (value: number) => Promise): Promise; (success?: (value: number) => B): Promise; } >function (x) { return p;} : (x: number) => Promise >x : number diff --git a/tests/baselines/reference/promiseTypeInference.errors.txt b/tests/baselines/reference/promiseTypeInference.errors.txt deleted file mode 100644 index 04ba3a0d878f8..0000000000000 --- a/tests/baselines/reference/promiseTypeInference.errors.txt +++ /dev/null @@ -1,40 +0,0 @@ -tests/cases/compiler/promiseTypeInference.ts(10,39): error TS2769: No overload matches this call. - Overload 1 of 2, '(success?: (value: string) => Promise): Promise', gave the following error. - Property 'catch' is missing in type 'IPromise' but required in type 'Promise'. - Overload 2 of 2, '(onfulfilled?: (value: string) => number | PromiseLike, onrejected?: (reason: any) => PromiseLike): Promise', gave the following error. - Type 'IPromise' is not assignable to type 'number | PromiseLike'. - Type 'IPromise' is not assignable to type 'PromiseLike'. - Types of property 'then' are incompatible. - Type '(success?: (value: number) => IPromise) => IPromise' is not assignable to type '(onfulfilled?: (value: number) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => PromiseLike'. - Types of parameters 'success' and 'onfulfilled' are incompatible. - Type 'TResult1 | PromiseLike' is not assignable to type 'IPromise'. - Type 'TResult1' is not assignable to type 'IPromise'. - - -==== tests/cases/compiler/promiseTypeInference.ts (1 errors) ==== - declare class Promise { - then(success?: (value: T) => Promise): Promise; - } - interface IPromise { - then(success?: (value: T) => IPromise): IPromise; - } - declare function load(name: string): Promise; - declare function convert(s: string): IPromise; - - var $$x = load("something").then(s => convert(s)); - ~~~~~~~~~~ -!!! error TS2769: No overload matches this call. -!!! error TS2769: Overload 1 of 2, '(success?: (value: string) => Promise): Promise', gave the following error. -!!! error TS2769: Property 'catch' is missing in type 'IPromise' but required in type 'Promise'. -!!! error TS2769: Overload 2 of 2, '(onfulfilled?: (value: string) => number | PromiseLike, onrejected?: (reason: any) => PromiseLike): Promise', gave the following error. -!!! error TS2769: Type 'IPromise' is not assignable to type 'number | PromiseLike'. -!!! error TS2769: Type 'IPromise' is not assignable to type 'PromiseLike'. -!!! error TS2769: Types of property 'then' are incompatible. -!!! error TS2769: Type '(success?: (value: number) => IPromise) => IPromise' is not assignable to type '(onfulfilled?: (value: number) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => PromiseLike'. -!!! error TS2769: Types of parameters 'success' and 'onfulfilled' are incompatible. -!!! error TS2769: Type 'TResult1 | PromiseLike' is not assignable to type 'IPromise'. -!!! error TS2769: Type 'TResult1' is not assignable to type 'IPromise'. -!!! related TS2728 /.ts/lib.es5.d.ts:1413:5: 'catch' is declared here. -!!! related TS6502 tests/cases/compiler/promiseTypeInference.ts:2:23: 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/promiseTypeInference.types b/tests/baselines/reference/promiseTypeInference.types index 36b3bdadd28ce..48d0ea3aa1091 100644 --- a/tests/baselines/reference/promiseTypeInference.types +++ b/tests/baselines/reference/promiseTypeInference.types @@ -3,7 +3,7 @@ declare class Promise { >Promise : Promise then(success?: (value: T) => Promise): Promise; ->then : { (onfulfilled?: (value: T) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: T) => Promise): Promise; } +>then : { (onfulfilled?: (value: T) => TResult1, onrejected?: (reason: any) => TResult2): Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)>; (success?: (value: T) => Promise): Promise; } >success : (value: T) => Promise >value : T } @@ -22,13 +22,13 @@ declare function convert(s: string): IPromise; >s : string var $$x = load("something").then(s => convert(s)); ->$$x : any ->load("something").then(s => convert(s)) : any ->load("something").then : { (onfulfilled?: (value: string) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: string) => Promise): Promise; } +>$$x : Promise> +>load("something").then(s => convert(s)) : Promise> +>load("something").then : { (onfulfilled?: (value: string) => TResult1, onrejected?: (reason: any) => TResult2): Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)>; (success?: (value: string) => Promise): Promise; } >load("something") : Promise >load : (name: string) => Promise >"something" : "something" ->then : { (onfulfilled?: (value: string) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: string) => Promise): Promise; } +>then : { (onfulfilled?: (value: string) => TResult1, onrejected?: (reason: any) => TResult2): Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)>; (success?: (value: string) => Promise): Promise; } >s => convert(s) : (s: string) => IPromise >s : string >convert(s) : IPromise diff --git a/tests/baselines/reference/promiseVoidErrorCallback.types b/tests/baselines/reference/promiseVoidErrorCallback.types index a1388cb04ef69..47d40b3366061 100644 --- a/tests/baselines/reference/promiseVoidErrorCallback.types +++ b/tests/baselines/reference/promiseVoidErrorCallback.types @@ -44,14 +44,14 @@ function f2(x: T1): T2 { var x3 = f1() >x3 : Promise<{ __t3: string; }> >f1() .then(f2, (e: Error) => { throw e;}) .then((x: T2) => { return { __t3: x.__t2 + "bar" };}) : Promise<{ __t3: string; }> ->f1() .then(f2, (e: Error) => { throw e;}) .then : (onfulfilled?: (value: T2) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>f1() .then(f2, (e: Error) => { throw e;}) .then : (onfulfilled?: (value: T2) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >f1() .then(f2, (e: Error) => { throw e;}) : Promise ->f1() .then : (onfulfilled?: (value: T1) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>f1() .then : (onfulfilled?: (value: T1) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >f1() : Promise >f1 : () => Promise .then(f2, (e: Error) => { ->then : (onfulfilled?: (value: T1) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : (onfulfilled?: (value: T1) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >f2 : (x: T1) => T2 >(e: Error) => { throw e;} : (e: Error) => never >e : Error @@ -61,7 +61,7 @@ var x3 = f1() }) .then((x: T2) => { ->then : (onfulfilled?: (value: T2) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : (onfulfilled?: (value: T2) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >(x: T2) => { return { __t3: x.__t2 + "bar" };} : (x: T2) => { __t3: string; } >x : T2 diff --git a/tests/baselines/reference/promises.types b/tests/baselines/reference/promises.types index 0640f0135498f..f8b55ffb31a02 100644 --- a/tests/baselines/reference/promises.types +++ b/tests/baselines/reference/promises.types @@ -1,12 +1,12 @@ === tests/cases/compiler/promises.ts === interface Promise { then(success?: (value: T) => U): Promise; ->then : { (onfulfilled?: (value: T) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: T) => U): Promise; (success?: (value: T) => Promise): Promise; } +>then : { (onfulfilled?: (value: T) => TResult1, onrejected?: (reason: any) => TResult2): Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)>; (success?: (value: T) => U): Promise; (success?: (value: T) => Promise): Promise; } >success : (value: T) => U >value : T then(success?: (value: T) => Promise): Promise; ->then : { (onfulfilled?: (value: T) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: T) => U): Promise; (success?: (value: T) => Promise): Promise; } +>then : { (onfulfilled?: (value: T) => TResult1, onrejected?: (reason: any) => TResult2): Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)>; (success?: (value: T) => U): Promise; (success?: (value: T) => Promise): Promise; } >success : (value: T) => Promise >value : T diff --git a/tests/baselines/reference/promisesWithConstraints.types b/tests/baselines/reference/promisesWithConstraints.types index 367cd6a61a677..a50bb347dc737 100644 --- a/tests/baselines/reference/promisesWithConstraints.types +++ b/tests/baselines/reference/promisesWithConstraints.types @@ -1,7 +1,7 @@ === tests/cases/compiler/promisesWithConstraints.ts === interface Promise { then(cb: (x: T) => Promise): Promise; ->then : { (onfulfilled?: (value: T) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (cb: (x: T) => Promise): Promise; } +>then : { (onfulfilled?: (value: T) => TResult1, onrejected?: (reason: any) => TResult2): Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)>; (cb: (x: T) => Promise): Promise; } >cb : (x: T) => Promise >x : T } diff --git a/tests/baselines/reference/specializationError.types b/tests/baselines/reference/specializationError.types index 8f0b5747bfa9d..ff7a73b6b76fa 100644 --- a/tests/baselines/reference/specializationError.types +++ b/tests/baselines/reference/specializationError.types @@ -1,7 +1,7 @@ === tests/cases/compiler/specializationError.ts === interface Promise { then(value: T): void; ->then : { (onfulfilled?: (value: T) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (value: T): void; } +>then : { (onfulfilled?: (value: T) => TResult1, onrejected?: (reason: any) => TResult2): Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)>; (value: T): void; } >value : T } diff --git a/tests/baselines/reference/syntheticDefaultExportsWithDynamicImports.types b/tests/baselines/reference/syntheticDefaultExportsWithDynamicImports.types index 3f1ef83a0ae9c..1d306362766d0 100644 --- a/tests/baselines/reference/syntheticDefaultExportsWithDynamicImports.types +++ b/tests/baselines/reference/syntheticDefaultExportsWithDynamicImports.types @@ -9,10 +9,10 @@ export = packageExport; === tests/cases/compiler/index.ts === import("package").then(({default: foo}) => foo(42)); >import("package").then(({default: foo}) => foo(42)) : Promise ->import("package").then : string; }, TResult2 = never>(onfulfilled?: (value: { default: (x: number) => string; }) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>import("package").then : string; }, TResult2 = never>(onfulfilled?: (value: { default: (x: number) => string; }) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >import("package") : Promise<{ default: (x: number) => string; }> >"package" : "package" ->then : string; }, TResult2 = never>(onfulfilled?: (value: { default: (x: number) => string; }) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : string; }, TResult2 = never>(onfulfilled?: (value: { default: (x: number) => string; }) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >({default: foo}) => foo(42) : ({ default: foo }: { default: (x: number) => string; }) => string >default : any >foo : (x: number) => string diff --git a/tests/baselines/reference/tsbuild/moduleSpecifiers/initial-build/resolves-correctly.js b/tests/baselines/reference/tsbuild/moduleSpecifiers/initial-build/resolves-correctly.js index 2ba8fa808170b..de82dbe66f4f0 100644 --- a/tests/baselines/reference/tsbuild/moduleSpecifiers/initial-build/resolves-correctly.js +++ b/tests/baselines/reference/tsbuild/moduleSpecifiers/initial-build/resolves-correctly.js @@ -14,8 +14,8 @@ exports.__esModule = true; "program": { "fileInfos": { "../../../.ts/lib.es5.d.ts": { - "version": "406734842058", - "signature": "406734842058" + "version": "304693544751", + "signature": "304693544751" }, "../../../.ts/lib.es2015.d.ts": { "version": "57263133672", @@ -114,8 +114,8 @@ exports.__esModule = true; "program": { "fileInfos": { "../../../.ts/lib.es5.d.ts": { - "version": "406734842058", - "signature": "406734842058" + "version": "304693544751", + "signature": "304693544751" }, "../../../.ts/lib.es2015.d.ts": { "version": "57263133672", @@ -237,8 +237,8 @@ exports.getVar = getVar; "program": { "fileInfos": { "../../../.ts/lib.es5.d.ts": { - "version": "406734842058", - "signature": "406734842058" + "version": "304693544751", + "signature": "304693544751" }, "../../../.ts/lib.es2015.d.ts": { "version": "57263133672", diff --git a/tests/baselines/reference/unionAndIntersectionInference1.types b/tests/baselines/reference/unionAndIntersectionInference1.types index 72d60545e6a51..097ebd832352d 100644 --- a/tests/baselines/reference/unionAndIntersectionInference1.types +++ b/tests/baselines/reference/unionAndIntersectionInference1.types @@ -190,12 +190,12 @@ const createTestAsync = (): Promise => Promise.resolve().then(() => ({ na >createTestAsync : () => Promise >(): Promise => Promise.resolve().then(() => ({ name: 'test' })) : () => Promise >Promise.resolve().then(() => ({ name: 'test' })) : Promise ->Promise.resolve().then : (onfulfilled?: (value: void) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>Promise.resolve().then : (onfulfilled?: (value: void) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >Promise.resolve() : Promise >Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } >Promise : PromiseConstructor >resolve : { (value: T | PromiseLike): Promise; (): Promise; } ->then : (onfulfilled?: (value: void) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : (onfulfilled?: (value: void) => TResult1, onrejected?: (reason: any) => TResult2) => Promise<(TResult1 extends PromiseLike ? UResult1 : TResult1) | (TResult2 extends PromiseLike ? UResult2 : TResult2)> >() => ({ name: 'test' }) : () => { name: "test"; } >({ name: 'test' }) : { name: "test"; } >{ name: 'test' } : { name: "test"; }