UNPKG

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