UNPKG

20.7 kBTypeScriptView Raw
1// These types are derived in large part from the Microsoft-supplied types for
2// ES2015 Promises. They have been tweaked to support RSVP's extensions to the
3// Promises A+ spec and the additional helper functions it supplies.
4
5declare namespace RSVP {
6 // All the Promise methods essentially flatten existing promises, so that
7 // you don't end up with `Promise<Promise<Promise<string>>>` if you happen
8 // to return another `Promise` from a `.then()` invocation, etc. So all of
9 // them can take a type or a promise-like/then-able type.
10 type Arg<T> = T | PromiseLike<T>;
11
12 // RSVP supplies status for promises in certain places.
13 enum State {
14 fulfilled = "fulfilled",
15 rejected = "rejected",
16 pending = "pending",
17 }
18
19 type Resolved<T> = {
20 state: State.fulfilled;
21 value: T;
22 };
23
24 type Rejected<T = any> = {
25 state: State.rejected;
26 reason: T;
27 };
28
29 type Pending = {
30 state: State.pending;
31 };
32
33 type PromiseState<T> = Resolved<T> | Rejected | Pending;
34
35 type Deferred<T> = {
36 promise: Promise<T>;
37 resolve: (value?: RSVP.Arg<T>) => void;
38 reject: (reason?: any) => void;
39 };
40
41 interface InstrumentEvent {
42 guid: string; // guid of promise. Must be globally unique, not just within the implementation
43 childGuid: string; // child of child promise (for chained via `then`)
44 eventName: string; // one of ['created', 'chained', 'fulfilled', 'rejected']
45 detail: any; // fulfillment value or rejection reason, if applicable
46 label: string; // label passed to promise's constructor
47 timeStamp: number; // milliseconds elapsed since 1 January 1970 00:00:00 UTC up until now
48 }
49
50 interface ObjectWithEventMixins {
51 on(
52 eventName: "created" | "chained" | "fulfilled" | "rejected",
53 listener: (event: InstrumentEvent) => void,
54 ): void;
55 on(eventName: "error", errorHandler: (reason: any) => void): void;
56 on(eventName: string, callback: (value: any) => void): void;
57 off(eventName: string, callback?: (value: any) => void): void;
58 trigger(eventName: string, options?: any, label?: string): void;
59 }
60
61 class EventTarget {
62 /** `RSVP.EventTarget.mixin` extends an object with EventTarget methods. */
63 static mixin(object: object): ObjectWithEventMixins;
64
65 /** Registers a callback to be executed when `eventName` is triggered */
66 static on(
67 eventName: "created" | "chained" | "fulfilled" | "rejected",
68 listener: (event: InstrumentEvent) => void,
69 ): void;
70 static on(eventName: "error", errorHandler: (reason: any) => void): void;
71 static on(eventName: string, callback: (value: any) => void): void;
72
73 /**
74 * You can use `off` to stop firing a particular callback for an event.
75 *
76 * If you don't pass a `callback` argument to `off`, ALL callbacks for the
77 * event will not be executed when the event fires.
78 */
79 static off(eventName: string, callback?: (value: any) => void): void;
80
81 /**
82 * Use `trigger` to fire custom events.
83 *
84 * You can also pass a value as a second argument to `trigger` that will be
85 * passed as an argument to all event listeners for the event
86 */
87 static trigger(eventName: string, options?: any, label?: string): void;
88 }
89
90 class Promise<T> implements PromiseLike<T> {
91 constructor(
92 executor: (resolve: (value?: RSVP.Arg<T>) => void, reject: (reason?: any) => void) => void,
93 label?: string,
94 );
95
96 new<T>(
97 executor: (resolve: (value?: RSVP.Arg<T>) => void, reject: (reason?: any) => void) => void,
98 ): RSVP.Promise<T>;
99
100 then<TResult1 = T, TResult2 = never>(
101 onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null,
102 onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null,
103 label?: string,
104 ): RSVP.Promise<TResult1 | TResult2>;
105
106 catch<TResult = never>(
107 onRejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null,
108 label?: string,
109 ): RSVP.Promise<T | TResult>;
110
111 finally<U>(onFinally?: U | PromiseLike<U>): RSVP.Promise<T>;
112
113 readonly [Symbol.toStringTag]: "Promise";
114
115 static all<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
116 values: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>, Arg<T6>, Arg<T7>, Arg<T8>, Arg<T9>, Arg<T10>],
117 label?: string,
118 ): RSVP.Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;
119 static all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(
120 values: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>, Arg<T6>, Arg<T7>, Arg<T8>, Arg<T9>],
121 label?: string,
122 ): RSVP.Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
123 static all<T1, T2, T3, T4, T5, T6, T7, T8>(
124 values: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>, Arg<T6>, Arg<T7>, Arg<T8>],
125 label?: string,
126 ): RSVP.Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>;
127 static all<T1, T2, T3, T4, T5, T6, T7>(
128 values: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>, Arg<T6>, Arg<T7>],
129 label?: string,
130 ): RSVP.Promise<[T1, T2, T3, T4, T5, T6, T7]>;
131 static all<T1, T2, T3, T4, T5, T6>(
132 values: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>, Arg<T6>],
133 label?: string,
134 ): RSVP.Promise<[T1, T2, T3, T4, T5, T6]>;
135 static all<T1, T2, T3, T4, T5>(
136 values: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>],
137 label?: string,
138 ): RSVP.Promise<[T1, T2, T3, T4, T5]>;
139 static all<T1, T2, T3, T4>(
140 values: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>],
141 label?: string,
142 ): RSVP.Promise<[T1, T2, T3, T4]>;
143 static all<T1, T2, T3>(values: [Arg<T1>, Arg<T2>, Arg<T3>], label?: string): RSVP.Promise<[T1, T2, T3]>;
144 static all<T1, T2>(values: [Arg<T1>, Arg<T2>], label?: string): Promise<[T1, T2]>;
145 static all<T>(values: Array<Arg<T>>, label?: string): RSVP.Promise<T[]>;
146
147 static race<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
148 values: [
149 Arg<T1>,
150 Arg<T2>,
151 Arg<T3>,
152 Arg<T4>,
153 Arg<T5>,
154 Arg<T6>,
155 Arg<T7>,
156 Arg<T8>,
157 Arg<T9>,
158 T10 | PromiseLike<T10>,
159 ],
160 label?: string,
161 ): RSVP.Promise<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9 | T10>;
162 static race<T1, T2, T3, T4, T5, T6, T7, T8, T9>(
163 values: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>, Arg<T6>, Arg<T7>, Arg<T8>, Arg<T9>],
164 label?: string,
165 ): RSVP.Promise<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9>;
166 static race<T1, T2, T3, T4, T5, T6, T7, T8>(
167 values: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>, Arg<T6>, Arg<T7>, Arg<T8>],
168 label?: string,
169 ): RSVP.Promise<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8>;
170 static race<T1, T2, T3, T4, T5, T6, T7>(
171 values: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>, Arg<T6>, Arg<T7>],
172 label?: string,
173 ): RSVP.Promise<T1 | T2 | T3 | T4 | T5 | T6 | T7>;
174 static race<T1, T2, T3, T4, T5, T6>(
175 values: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>, Arg<T6>],
176 label?: string,
177 ): RSVP.Promise<T1 | T2 | T3 | T4 | T5 | T6>;
178 static race<T1, T2, T3, T4, T5>(
179 values: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>],
180 label?: string,
181 ): RSVP.Promise<T1 | T2 | T3 | T4 | T5>;
182 static race<T1, T2, T3, T4>(
183 values: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>],
184 label?: string,
185 ): RSVP.Promise<T1 | T2 | T3 | T4>;
186 static race<T1, T2, T3>(values: [Arg<T1>, Arg<T2>, Arg<T3>], label?: string): RSVP.Promise<T1 | T2 | T3>;
187 static race<T1, T2>(values: [Arg<T1>, Arg<T2>], label?: string): RSVP.Promise<T1 | T2>;
188 static race<T>(values: Array<Arg<T>>, label?: string): RSVP.Promise<T>;
189
190 static reject(reason?: any, label?: string): RSVP.Promise<never>;
191
192 static resolve<T>(value?: Arg<T>, label?: string): RSVP.Promise<T>;
193 static resolve(): RSVP.Promise<void>;
194
195 /**
196 * @deprecated
197 */
198 static cast: typeof RSVP.Promise.resolve;
199 }
200
201 const all: typeof Promise.all;
202 const race: typeof Promise.race;
203 const reject: typeof Promise.reject;
204 const resolve: typeof Promise.resolve;
205 function rethrow(reason: any): void;
206
207 const cast: typeof Promise.cast;
208
209 const on: typeof EventTarget.on;
210 const off: typeof EventTarget.off;
211
212 // ----- denodeify ----- //
213 // Here be absurd things because we don't have variadic types. All of
214 // this will go away if we can ever write this:
215 //
216 // denodeify<...T, ...A>(
217 // nodeFunc: (...args: ...A, callback: (err: any, ...cbArgs: ...T) => any) => void,
218 // options?: false
219 // ): (...args: ...A) => RSVP.Promise<...T>
220 //
221 // That day, however, may never come. So, in the meantime, we do this.
222
223 function denodeify<T1, T2, T3, A>(
224 nodeFunc: (arg1: A, callback: (err: any, data1: T1, data2: T2, data3: T3) => void) => void,
225 options?: false,
226 ): (arg1: A) => RSVP.Promise<T1>;
227
228 function denodeify<T1, T2, A>(
229 nodeFunc: (arg1: A, callback: (err: any, data1: T1, data2: T2) => void) => void,
230 options?: false,
231 ): (arg1: A) => RSVP.Promise<T1>;
232
233 function denodeify<T, A>(
234 nodeFunc: (arg1: A, callback: (err: any, data: T) => void) => void,
235 options?: false,
236 ): (arg1: A) => RSVP.Promise<T>;
237
238 function denodeify<T1, T2, T3, A>(
239 nodeFunc: (arg1: A, callback: (err: any, data1: T1, data2: T2, data3: T3) => void) => void,
240 options: true,
241 ): (arg1: A) => RSVP.Promise<[T1, T2, T3]>;
242
243 function denodeify<T1, T2, A>(
244 nodeFunc: (arg1: A, callback: (err: any, data1: T1, data2: T2) => void) => void,
245 options: true,
246 ): (arg1: A) => RSVP.Promise<[T1, T2]>;
247
248 function denodeify<T, A>(
249 nodeFunc: (arg1: A, callback: (err: any, data: T) => void) => void,
250 options: true,
251 ): (arg1: A) => RSVP.Promise<[T]>;
252
253 function denodeify<T1, T2, T3, A, K1 extends string, K2 extends string, K3 extends string>(
254 nodeFunc: (arg1: A, callback: (err: any, data1: T1, data2: T2, data3: T3) => void) => void,
255 options: [K1, K2, K3],
256 ): (arg1: A) => RSVP.Promise<{ [K in K1]: T1 } & { [K in K2]: T2 } & { [K in K3]: T3 }>;
257
258 function denodeify<T1, T2, A, K1 extends string, K2 extends string>(
259 nodeFunc: (arg1: A, callback: (err: any, data1: T1, data2: T2) => void) => void,
260 options: [K1, K2],
261 ): (arg1: A) => RSVP.Promise<{ [K in K1]: T1 } & { [K in K2]: T2 }>;
262
263 function denodeify<T, A, K1 extends string>(
264 nodeFunc: (arg1: A, callback: (err: any, data: T) => void) => void,
265 options: [K1],
266 ): (arg1: A) => RSVP.Promise<{ [K in K1]: T }>;
267
268 // ----- hash and hashSettled ----- //
269 function hash<T>(object: { [P in keyof T]: Arg<T[P]> }, label?: string): RSVP.Promise<T>;
270 function hashSettled<T>(
271 object: { [P in keyof T]: Arg<T[P]> },
272 label?: string,
273 ): RSVP.Promise<{ [P in keyof T]: PromiseState<T[P]> }>;
274
275 function allSettled<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
276 entries: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>, Arg<T6>, Arg<T7>, Arg<T8>, Arg<T9>, Arg<T10>],
277 label?: string,
278 ): RSVP.Promise<
279 [
280 PromiseState<T1>,
281 PromiseState<T2>,
282 PromiseState<T3>,
283 PromiseState<T4>,
284 PromiseState<T5>,
285 PromiseState<T6>,
286 PromiseState<T7>,
287 PromiseState<T8>,
288 PromiseState<T9>,
289 ]
290 >;
291 function allSettled<T1, T2, T3, T4, T5, T6, T7, T8, T9>(
292 entries: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>, Arg<T6>, Arg<T7>, Arg<T8>, Arg<T9>],
293 label?: string,
294 ): RSVP.Promise<
295 [
296 PromiseState<T1>,
297 PromiseState<T2>,
298 PromiseState<T3>,
299 PromiseState<T4>,
300 PromiseState<T5>,
301 PromiseState<T6>,
302 PromiseState<T7>,
303 PromiseState<T8>,
304 PromiseState<T9>,
305 ]
306 >;
307 function allSettled<T1, T2, T3, T4, T5, T6, T7, T8>(
308 entries: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>, Arg<T6>, Arg<T7>, Arg<T8>],
309 label?: string,
310 ): RSVP.Promise<
311 [
312 PromiseState<T1>,
313 PromiseState<T2>,
314 PromiseState<T3>,
315 PromiseState<T4>,
316 PromiseState<T5>,
317 PromiseState<T6>,
318 PromiseState<T7>,
319 PromiseState<T8>,
320 ]
321 >;
322 function allSettled<T1, T2, T3, T4, T5, T6, T7>(
323 entries: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>, Arg<T6>, Arg<T7>],
324 label?: string,
325 ): RSVP.Promise<
326 [
327 PromiseState<T1>,
328 PromiseState<T2>,
329 PromiseState<T3>,
330 PromiseState<T4>,
331 PromiseState<T5>,
332 PromiseState<T6>,
333 PromiseState<T7>,
334 ]
335 >;
336 function allSettled<T1, T2, T3, T4, T5, T6>(
337 entries: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>, Arg<T6>],
338 label?: string,
339 ): RSVP.Promise<
340 [PromiseState<T1>, PromiseState<T2>, PromiseState<T3>, PromiseState<T4>, PromiseState<T5>, PromiseState<T6>]
341 >;
342 function allSettled<T1, T2, T3, T4, T5>(
343 entries: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>],
344 label?: string,
345 ): RSVP.Promise<[PromiseState<T1>, PromiseState<T2>, PromiseState<T3>, PromiseState<T4>, PromiseState<T5>]>;
346 function allSettled<T1, T2, T3, T4>(
347 entries: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>],
348 label?: string,
349 ): RSVP.Promise<[PromiseState<T1>, PromiseState<T2>, PromiseState<T3>, PromiseState<T4>]>;
350 function allSettled<T1, T2, T3>(
351 entries: [Arg<T1>, Arg<T2>, Arg<T3>],
352 label?: string,
353 ): RSVP.Promise<[PromiseState<T1>, PromiseState<T2>, PromiseState<T3>]>;
354 function allSettled<T1, T2>(
355 entries: [Arg<T1>, Arg<T2>],
356 label?: string,
357 ): RSVP.Promise<[PromiseState<T1>, PromiseState<T2>]>;
358 function allSettled<T>(entries: Array<Arg<T>>, label?: string): RSVP.Promise<[PromiseState<T>]>;
359
360 function map<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, U>(
361 entries: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>, Arg<T6>, Arg<T7>, Arg<T8>, Arg<T9>, Arg<T10>],
362 mapFn: (item: T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9 | T10) => U,
363 label?: string,
364 ): RSVP.Promise<U[] & { length: 10 }>;
365
366 function map<T1, T2, T3, T4, T5, T6, T7, T8, T9, U>(
367 entries: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>, Arg<T6>, Arg<T7>, Arg<T8>, Arg<T9>],
368 mapFn: (item: T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9) => U,
369 label?: string,
370 ): RSVP.Promise<U[] & { length: 9 }>;
371 function map<T1, T2, T3, T4, T5, T6, T7, T8, U>(
372 entries: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>, Arg<T6>, Arg<T7>, Arg<T8>],
373 mapFn: (item: T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8) => U,
374 label?: string,
375 ): RSVP.Promise<U[] & { length: 8 }>;
376 function map<T1, T2, T3, T4, T5, T6, T7, U>(
377 entries: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>, Arg<T6>, Arg<T7>],
378 mapFn: (item: T1 | T2 | T3 | T4 | T5 | T6 | T7) => U,
379 label?: string,
380 ): RSVP.Promise<U[] & { length: 7 }>;
381 function map<T1, T2, T3, T4, T5, T6, U>(
382 entries: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>, Arg<T6>],
383 mapFn: (item: T1 | T2 | T3 | T4 | T5 | T6) => U,
384 label?: string,
385 ): RSVP.Promise<U[] & { length: 6 }>;
386 function map<T1, T2, T3, T4, T5, U>(
387 entries: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>],
388 mapFn: (item: T1 | T2 | T3 | T4 | T5) => U,
389 label?: string,
390 ): RSVP.Promise<U[] & { length: 5 }>;
391 function map<T1, T2, T3, T4, U>(
392 entries: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>],
393 mapFn: (item: T1 | T2 | T3 | T4) => U,
394 label?: string,
395 ): RSVP.Promise<U[] & { length: 4 }>;
396 function map<T1, T2, T3, U>(
397 entries: [Arg<T1>, Arg<T2>, Arg<T3>],
398 mapFn: (item: T1 | T2 | T3) => U,
399 label?: string,
400 ): RSVP.Promise<U[] & { length: 3 }>;
401 function map<T1, T2, U>(
402 entries: [Arg<T1>, Arg<T2>],
403 mapFn: (item: T1 | T2) => U,
404 label?: string,
405 ): RSVP.Promise<U[] & { length: 2 }>;
406 function map<T, U>(
407 entries: Array<Arg<T>>,
408 mapFn: (item: T) => U,
409 label?: string,
410 ): RSVP.Promise<U[] & { length: 1 }>;
411
412 function filter<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
413 entries: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>, Arg<T6>, Arg<T7>, Arg<T8>, Arg<T9>, Arg<T10>],
414 filterFn: (item: T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9 | T10) => boolean,
415 label?: string,
416 ): RSVP.Promise<Array<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9 | T10>>;
417 function filter<T1, T2, T3, T4, T5, T6, T7, T8, T9>(
418 entries: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>, Arg<T6>, Arg<T7>, Arg<T8>, Arg<T9>],
419 filterFn: (item: T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9) => boolean,
420 label?: string,
421 ): RSVP.Promise<Array<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9>>;
422 function filter<T1, T2, T3, T4, T5, T6, T7, T8>(
423 entries: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>, Arg<T6>, Arg<T7>, Arg<T8>],
424 filterFn: (item: T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8) => boolean,
425 label?: string,
426 ): RSVP.Promise<Array<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8>>;
427 function filter<T1, T2, T3, T4, T5, T6, T7>(
428 entries: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>, Arg<T6>, Arg<T7>],
429 filterFn: (item: T1 | T2 | T3 | T4 | T5 | T6 | T7) => boolean,
430 label?: string,
431 ): RSVP.Promise<Array<T1 | T2 | T3 | T4 | T5 | T6 | T7>>;
432 function filter<T1, T2, T3, T4, T5, T6>(
433 entries: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>, Arg<T6>],
434 filterFn: (item: T1 | T2 | T3 | T4 | T5 | T6) => boolean,
435 label?: string,
436 ): RSVP.Promise<Array<T1 | T2 | T3 | T4 | T5 | T6> & { length: 6 }>;
437 function filter<T1, T2, T3, T4, T5>(
438 entries: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>],
439 filterFn: (item: T1 | T2 | T3 | T4 | T5) => boolean,
440 label?: string,
441 ): RSVP.Promise<Array<T1 | T2 | T3 | T4 | T5>>;
442 function filter<T1, T2, T3, T4>(
443 entries: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>],
444 filterFn: (item: T1 | T2 | T3 | T4) => boolean,
445 label?: string,
446 ): RSVP.Promise<Array<T1 | T2 | T3 | T4>>;
447 function filter<T1, T2, T3>(
448 entries: [Arg<T1>, Arg<T2>, Arg<T3>],
449 filterFn: (item: T1 | T2 | T3) => boolean,
450 label?: string,
451 ): RSVP.Promise<Array<T1 | T2 | T3>>;
452 function filter<T1, T2>(
453 entries: [Arg<T1>, Arg<T2>],
454 filterFn: (item: T1 | T2) => boolean,
455 label?: string,
456 ): RSVP.Promise<Array<T1 | T2>>;
457 function filter<T>(entries: Array<Arg<T>>, filterFn: (item: T) => boolean, label?: string): RSVP.Promise<T[]>;
458
459 function defer<T>(label?: string): Deferred<T>;
460
461 function configure<T>(name: string): T;
462 function configure<T>(name: string, value: T): void;
463
464 function asap<T, U>(callback: (callbackArg: T) => U, arg: T): void;
465
466 const async: typeof asap;
467}
468
469export default RSVP;
470
471export interface Promise<T> extends RSVP.Promise<T> {}
472export const Promise: typeof RSVP.Promise;
473
474export interface EventTarget extends RSVP.EventTarget {}
475export const EventTarget: typeof RSVP.EventTarget;
476
477export const asap: typeof RSVP.asap;
478export const cast: typeof RSVP.cast;
479export const all: typeof RSVP.all;
480export const allSettled: typeof RSVP.allSettled;
481export const race: typeof RSVP.race;
482export const hash: typeof RSVP.hash;
483export const hashSettled: typeof RSVP.hashSettled;
484export const rethrow: typeof RSVP.rethrow;
485export const defer: typeof RSVP.defer;
486export const denodeify: typeof RSVP.denodeify;
487export const configure: typeof RSVP.configure;
488export const on: typeof RSVP.on;
489export const off: typeof RSVP.off;
490export const resolve: typeof RSVP.resolve;
491export const reject: typeof RSVP.reject;
492export const map: typeof RSVP.map;
493export const async: typeof RSVP.async;
494export const filter: typeof RSVP.filter;
495
\No newline at end of file