mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* added type definitions for promise.allsettled * code style update * code style and compatibility fixes * removed the (hopefully not needed) tslint disable flag * more code style fixes * code style fix * fixed the result type for iterable non-tuple inputs, made the types more practical * fixed code style
15 lines
454 B
TypeScript
15 lines
454 B
TypeScript
export interface PromiseResolution<T> {
|
|
status: 'fulfilled';
|
|
value: T;
|
|
}
|
|
|
|
export interface PromiseRejection<E> {
|
|
status: 'rejected';
|
|
reason: E;
|
|
}
|
|
|
|
export type PromiseResult<T, E = unknown> = PromiseResolution<T> | PromiseRejection<E>;
|
|
|
|
export type PromiseTuple<T extends [unknown, ...unknown[]]> = {[P in keyof T]: Promise<T[P]>};
|
|
export type PromiseResultTuple<T extends [unknown, ...unknown[]]> = {[P in keyof T]: PromiseResult<T[P]>};
|