89 lines
3 KiB
Text
89 lines
3 KiB
Text
=== tests/cases/compiler/promiseVoidErrorCallback.ts ===
|
|
interface T1 {
|
|
>T1 : T1
|
|
|
|
__t1: string;
|
|
>__t1 : string
|
|
}
|
|
|
|
interface T2 {
|
|
>T2 : T2
|
|
|
|
__t2: string;
|
|
>__t2 : string
|
|
}
|
|
|
|
interface T3 {
|
|
>T3 : T3
|
|
|
|
__t3: string;
|
|
>__t3 : string
|
|
}
|
|
|
|
function f1(): Promise<T1> {
|
|
>f1 : () => Promise<T1>
|
|
>Promise : Promise<T>
|
|
>T1 : T1
|
|
|
|
return Promise.resolve({ __t1: "foo_t1" });
|
|
>Promise.resolve({ __t1: "foo_t1" }) : Promise<{ __t1: string; }>
|
|
>Promise.resolve : { <T>(value: T | PromiseLike<T>): Promise<T>; (): Promise<void>; }
|
|
>Promise : PromiseConstructor
|
|
>resolve : { <T>(value: T | PromiseLike<T>): Promise<T>; (): Promise<void>; }
|
|
>{ __t1: "foo_t1" } : { __t1: string; }
|
|
>__t1 : string
|
|
>"foo_t1" : string
|
|
}
|
|
|
|
function f2(x: T1): T2 {
|
|
>f2 : (x: T1) => T2
|
|
>x : T1
|
|
>T1 : T1
|
|
>T2 : T2
|
|
|
|
return { __t2: x.__t1 + ":foo_21" };
|
|
>{ __t2: x.__t1 + ":foo_21" } : { __t2: string; }
|
|
>__t2 : string
|
|
>x.__t1 + ":foo_21" : string
|
|
>x.__t1 : string
|
|
>x : T1
|
|
>__t1 : string
|
|
>":foo_21" : string
|
|
}
|
|
|
|
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 : { <TResult>(onfulfilled?: (value: T2) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>; <TResult>(onfulfilled?: (value: T2) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): Promise<TResult>; }
|
|
>f1() .then(f2, (e: Error) => { throw e;}) : Promise<T2>
|
|
>f1() .then : { <TResult>(onfulfilled?: (value: T1) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>; <TResult>(onfulfilled?: (value: T1) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): Promise<TResult>; }
|
|
>f1() : Promise<T1>
|
|
>f1 : () => Promise<T1>
|
|
|
|
.then(f2, (e: Error) => {
|
|
>then : { <TResult>(onfulfilled?: (value: T1) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>; <TResult>(onfulfilled?: (value: T1) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): Promise<TResult>; }
|
|
>f2 : (x: T1) => T2
|
|
>(e: Error) => { throw e;} : (e: Error) => void
|
|
>e : Error
|
|
>Error : Error
|
|
|
|
throw e;
|
|
>e : Error
|
|
|
|
})
|
|
.then((x: T2) => {
|
|
>then : { <TResult>(onfulfilled?: (value: T2) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>; <TResult>(onfulfilled?: (value: T2) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): Promise<TResult>; }
|
|
>(x: T2) => { return { __t3: x.__t2 + "bar" };} : (x: T2) => { __t3: string; }
|
|
>x : T2
|
|
>T2 : T2
|
|
|
|
return { __t3: x.__t2 + "bar" };
|
|
>{ __t3: x.__t2 + "bar" } : { __t3: string; }
|
|
>__t3 : string
|
|
>x.__t2 + "bar" : string
|
|
>x.__t2 : string
|
|
>x : T2
|
|
>__t2 : string
|
|
>"bar" : string
|
|
|
|
});
|