mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-02 19:43:20 +08:00
Add Q.Promise.all, the member function (#18308)
This commit is contained in:
22
types/q/v0/index.d.ts
vendored
22
types/q/v0/index.d.ts
vendored
@@ -166,6 +166,28 @@ declare namespace Q {
|
||||
* - { state: "rejected", reason: <rejection reason> }
|
||||
*/
|
||||
inspect(): PromiseState<T>;
|
||||
|
||||
all<A, B, C, D, E, F>(this: Promise<[IWhenable<A>, IWhenable<B>, IWhenable<C>, IWhenable<D>, IWhenable<E>, IWhenable<F>]>): Promise<[A, B, C, D, E, F]>;
|
||||
/**
|
||||
* Returns a promise that is fulfilled with an array containing the fulfillment value of each promise, or is rejected with the same rejection reason as the first promise to be rejected.
|
||||
*/
|
||||
all<A, B, C, D, E>(this: Promise<[IWhenable<A>, IWhenable<B>, IWhenable<C>, IWhenable<D>, IWhenable<E>]>): Promise<[A, B, C, D, E]>;
|
||||
/**
|
||||
* Returns a promise that is fulfilled with an array containing the fulfillment value of each promise, or is rejected with the same rejection reason as the first promise to be rejected.
|
||||
*/
|
||||
all<A, B, C, D>(this: Promise<[IWhenable<A>, IWhenable<B>, IWhenable<C>, IWhenable<D>]>): Promise<[A, B, C, D]>;
|
||||
/**
|
||||
* Returns a promise that is fulfilled with an array containing the fulfillment value of each promise, or is rejected with the same rejection reason as the first promise to be rejected.
|
||||
*/
|
||||
all<A, B, C>(this: Promise<[IWhenable<A>, IWhenable<B>, IWhenable<C>]>): Promise<[A, B, C]>;
|
||||
/**
|
||||
* Returns a promise that is fulfilled with an array containing the fulfillment value of each promise, or is rejected with the same rejection reason as the first promise to be rejected.
|
||||
*/
|
||||
all<A, B>(this: Promise<[IWhenable<A>, IWhenable<B>]>): Promise<[A, B]>;
|
||||
/**
|
||||
* Returns a promise that is fulfilled with an array containing the fulfillment value of each promise, or is rejected with the same rejection reason as the first promise to be rejected.
|
||||
*/
|
||||
all<T>(this: Promise<IWhenable<T>[]>): Promise<T[]>;
|
||||
}
|
||||
|
||||
interface PromiseState<T> {
|
||||
|
||||
@@ -220,7 +220,9 @@ var y2 = Q().then(() => {
|
||||
return <[typeof s, typeof n]>[s, n];
|
||||
});
|
||||
|
||||
var p1: Q.Promise<[string, number]> = y1.all();
|
||||
var p2: Q.Promise<[string, number]> = y1.then(val => Q.all(val));
|
||||
var p3: Q.Promise<[string, number]> = Q.all(y1);
|
||||
var p4: Q.Promise<[string, number]> = y2.all();
|
||||
var p5: Q.Promise<[string, number]> = y2.then(val => Q.all(val));
|
||||
var p6: Q.Promise<[string, number]> = Q.all(y2);
|
||||
|
||||
Reference in New Issue
Block a user