Skip to content

Commit

Permalink
refactor(lib/es2020): Improve naming of Promise.allSettled types
Browse files Browse the repository at this point in the history
  • Loading branch information
ExE-Boss committed Jan 2, 2020
1 parent 926c561 commit ec3628c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/lib/es2020.promise.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
interface PromiseResolvedResult<T> {
interface PromiseFulfilledResult<T> {
status: "fulfilled";
value: T;
}
Expand All @@ -8,7 +8,7 @@ interface PromiseRejectedResult {
reason: any;
}

type PromiseSettledResult<T> = PromiseResolvedResult<T> | PromiseRejectedResult;
type PromiseSettledResult<T> = PromiseFulfilledResult<T> | PromiseRejectedResult;

interface PromiseConstructor {
/**
Expand All @@ -17,7 +17,8 @@ interface PromiseConstructor {
* @param values An array of Promises.
* @returns A new Promise.
*/
allSettled<T extends readonly any[] | readonly [any]>(values: T): Promise<{ -readonly [P in keyof T]: PromiseSettledResult<T[P] extends PromiseLike<infer U> ? U : T[P]> }>;
allSettled<T extends readonly unknown[] | readonly [unknown]>(values: T):
Promise<{ -readonly [P in keyof T]: PromiseSettledResult<T[P] extends PromiseLike<infer U> ? U : T[P]> }>;

/**
* Creates a Promise that is resolved with an array of results when all
Expand Down

0 comments on commit ec3628c

Please sign in to comment.