1interface PromiseFulfilledResult<T> { 2 status: "fulfilled"; 3 value: T; 4} 5 6interface PromiseRejectedResult { 7 status: "rejected"; 8 reason: any; 9} 10 11type PromiseSettledResult<T> = PromiseFulfilledResult<T> | PromiseRejectedResult; 12 13interface PromiseConstructor { 14 /** 15 * Creates a Promise that is resolved with an array of results when all 16 * of the provided Promises resolve or reject. 17 * @param values An array of Promises. 18 * @returns A new Promise. 19 */ 20 allSettled<T extends readonly unknown[] | readonly [unknown]>(values: T): 21 Promise<{ -readonly [P in keyof T]: PromiseSettledResult<T[P] extends PromiseLike<infer U> ? U : T[P]> }>; 22 23 /** 24 * Creates a Promise that is resolved with an array of results when all 25 * of the provided Promises resolve or reject. 26 * @param values An array of Promises. 27 * @returns A new Promise. 28 */ 29 allSettled<T>(values: Iterable<T>): Promise<PromiseSettledResult<T extends PromiseLike<infer U> ? U : T>[]>; 30} 31