File: promiseVoidErrorCallback.types

package info (click to toggle)
node-typescript 5.0.4%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 459,140 kB
  • sloc: javascript: 1,972,754; makefile: 6; sh: 1
file content (77 lines) | stat: -rw-r--r-- 2,670 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
=== tests/cases/compiler/promiseVoidErrorCallback.ts ===
interface T1 {
    __t1: string;
>__t1 : string
}

interface T2 {
    __t2: string;
>__t2 : string
}

interface T3 {
    __t3: string;
>__t3 : string
}

function f1(): Promise<T1> {
>f1 : () => Promise<T1>

    return Promise.resolve({ __t1: "foo_t1" });
>Promise.resolve({ __t1: "foo_t1" }) : Promise<{ __t1: string; }>
>Promise.resolve : { (): Promise<void>; <T>(value: T): Promise<Awaited<T>>; <T>(value: T | PromiseLike<T>): Promise<Awaited<T>>; }
>Promise : PromiseConstructor
>resolve : { (): Promise<void>; <T>(value: T): Promise<Awaited<T>>; <T>(value: T | PromiseLike<T>): Promise<Awaited<T>>; }
>{ __t1: "foo_t1" } : { __t1: string; }
>__t1 : string
>"foo_t1" : "foo_t1"
}

function f2(x: T1): T2 {
>f2 : (x: T1) => T2
>x : T1

    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" : ":foo_21"
}

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 : <TResult1 = T2, TResult2 = never>(onfulfilled?: (value: T2) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>f1()    .then(f2, (e: Error) => {    throw e;}) : Promise<T2>
>f1()    .then : <TResult1 = T1, TResult2 = never>(onfulfilled?: (value: T1) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>f1() : Promise<T1>
>f1 : () => Promise<T1>

    .then(f2, (e: Error) => {
>then : <TResult1 = T1, TResult2 = never>(onfulfilled?: (value: T1) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>f2 : (x: T1) => T2
>(e: Error) => {    throw e;} : (e: Error) => never
>e : Error

    throw e;
>e : Error

})
    .then((x: T2) => {
>then : <TResult1 = T2, TResult2 = never>(onfulfilled?: (value: T2) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>(x: T2) => {    return { __t3: x.__t2 + "bar" };} : (x: T2) => { __t3: string; }
>x : 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" : "bar"

});