• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/// <reference lib="dom" />
2
3interface Thenable<T> extends PromiseLike<T> { }
4
5// JQuery's Promise type
6interface PromiseBase<TR, TJ, TN,
7    UR, UJ, UN,
8    VR, VJ, VN,
9    SR, SJ, SN> {
10    then<ARD = never, AJD = never, AND = never,
11        BRD = never, BJD = never, BND = never,
12        CRD = never, CJD = never, CND = never,
13        RRD = never, RJD = never, RND = never,
14        ARF = never, AJF = never, ANF = never,
15        BRF = never, BJF = never, BNF = never,
16        CRF = never, CJF = never, CNF = never,
17        RRF = never, RJF = never, RNF = never,
18        ARP = never, AJP = never, ANP = never,
19        BRP = never, BJP = never, BNP = never,
20        CRP = never, CJP = never, CNP = never,
21        RRP = never, RJP = never, RNP = never>(
22            doneFilter: (t: TR, u: UR, v: VR, ...s: SR[]) => PromiseBase<ARD, AJD, AND,
23                BRD, BJD, BND,
24                CRD, CJD, CND,
25                RRD, RJD, RND> | Thenable<ARD> | ARD,
26            failFilter: (t: TJ, u: UJ, v: VJ, ...s: SJ[]) => PromiseBase<ARF, AJF, ANF,
27                BRF, BJF, BNF,
28                CRF, CJF, CNF,
29                RRF, RJF, RNF> | Thenable<ARF> | ARF,
30            progressFilter: (t: TN, u: UN, v: VN, ...s: SN[]) => PromiseBase<ARP, AJP, ANP,
31                BRP, BJP, BNP,
32                CRP, CJP, CNP,
33                RRP, RJP, RNP> | Thenable<ANP> | ANP): PromiseBase<ARD | ARF | ARP, AJD | AJF | AJP, AND | ANF | ANP,
34        BRD | BRF | BRP, BJD | BJF | BJP, BND | BNF | BNP,
35        CRD | CRF | CRP, CJD | CJF | CJP, CND | CNF | CNP,
36        RRD | RRF | RRP, RJD | RJF | RJP, RND | RNF | RNP>;
37    then<ARF = never, AJF = never, ANF = never,
38        BRF = never, BJF = never, BNF = never,
39        CRF = never, CJF = never, CNF = never,
40        RRF = never, RJF = never, RNF = never,
41        ARP = never, AJP = never, ANP = never,
42        BRP = never, BJP = never, BNP = never,
43        CRP = never, CJP = never, CNP = never,
44        RRP = never, RJP = never, RNP = never>(
45            doneFilter: null,
46            failFilter: (t: TJ, u: UJ, v: VJ, ...s: SJ[]) => PromiseBase<ARF, AJF, ANF,
47                BRF, BJF, BNF,
48                CRF, CJF, CNF,
49                RRF, RJF, RNF> | Thenable<ARF> | ARF,
50            progressFilter: (t: TN, u: UN, v: VN, ...s: SN[]) => PromiseBase<ARP, AJP, ANP,
51                BRP, BJP, BNP,
52                CRP, CJP, CNP,
53                RRP, RJP, RNP> | Thenable<ANP> | ANP): PromiseBase<ARF | ARP, AJF | AJP, ANF | ANP,
54        BRF | BRP, BJF | BJP, BNF | BNP,
55        CRF | CRP, CJF | CJP, CNF | CNP,
56        RRF | RRP, RJF | RJP, RNF | RNP>;
57    then<ARP = never, AJP = never, ANP = never,
58        BRP = never, BJP = never, BNP = never,
59        CRP = never, CJP = never, CNP = never,
60        RRP = never, RJP = never, RNP = never>(
61            doneFilter: null,
62            failFilter: null,
63            progressFilter?: (t: TN, u: UN, v: VN, ...s: SN[]) => PromiseBase<ARP, AJP, ANP,
64                BRP, BJP, BNP,
65                CRP, CJP, CNP,
66                RRP, RJP, RNP> | Thenable<ANP> | ANP): PromiseBase<ARP, AJP, ANP,
67        BRP, BJP, BNP,
68        CRP, CJP, CNP,
69        RRP, RJP, RNP>;
70    then<ARD = never, AJD = never, AND = never,
71        BRD = never, BJD = never, BND = never,
72        CRD = never, CJD = never, CND = never,
73        RRD = never, RJD = never, RND = never,
74        ARF = never, AJF = never, ANF = never,
75        BRF = never, BJF = never, BNF = never,
76        CRF = never, CJF = never, CNF = never,
77        RRF = never, RJF = never, RNF = never>(
78            doneFilter: (t: TR, u: UR, v: VR, ...s: SR[]) => PromiseBase<ARD, AJD, AND,
79                BRD, BJD, BND,
80                CRD, CJD, CND,
81                RRD, RJD, RND> | Thenable<ARD> | ARD,
82            failFilter: (t: TJ, u: UJ, v: VJ, ...s: SJ[]) => PromiseBase<ARF, AJF, ANF,
83                BRF, BJF, BNF,
84                CRF, CJF, CNF,
85                RRF, RJF, RNF> | Thenable<ARF> | ARF,
86            progressFilter?: null): PromiseBase<ARD | ARF, AJD | AJF, AND | ANF,
87        BRD | BRF, BJD | BJF, BND | BNF,
88        CRD | CRF, CJD | CJF, CND | CNF,
89        RRD | RRF, RJD | RJF, RND | RNF>;
90    then<ARF = never, AJF = never, ANF = never,
91        BRF = never, BJF = never, BNF = never,
92        CRF = never, CJF = never, CNF = never,
93        RRF = never, RJF = never, RNF = never>(
94            doneFilter: null,
95            failFilter: (t: TJ, u: UJ, v: VJ, ...s: SJ[]) => PromiseBase<ARF, AJF, ANF,
96                BRF, BJF, BNF,
97                CRF, CJF, CNF,
98                RRF, RJF, RNF> | Thenable<ARF> | ARF,
99            progressFilter?: null): PromiseBase<ARF, AJF, ANF,
100        BRF, BJF, BNF,
101        CRF, CJF, CNF,
102        RRF, RJF, RNF>;
103    then<ARD = never, AJD = never, AND = never,
104        BRD = never, BJD = never, BND = never,
105        CRD = never, CJD = never, CND = never,
106        RRD = never, RJD = never, RND = never>(
107            doneFilter: (t: TR, u: UR, v: VR, ...s: SR[]) => PromiseBase<ARD, AJD, AND,
108                BRD, BJD, BND,
109                CRD, CJD, CND,
110                RRD, RJD, RND> | Thenable<ARD> | ARD,
111            failFilter?: null,
112            progressFilter?: null): PromiseBase<ARD, AJD, AND,
113        BRD, BJD, BND,
114        CRD, CJD, CND,
115        RRD, RJD, RND>;
116}
117
118interface Promise3<TR, TJ, TN,
119    UR, UJ, UN,
120    VR, VJ, VN> extends PromiseBase<TR, TJ, TN,
121    UR, UJ, UN,
122    VR, VJ, VN,
123    never, never, never> { }
124
125type T = Awaited<Promise3<string, Error, number, {}, string, boolean, any, Element, never>>; // string