/** * @template V * @typedef {V | PledgeInstance} Pledge */ /** * @template {any} Val * @template {any} [CancelReason=Error] */ export class PledgeInstance { /** * @type {Val | CancelReason | null} */ _v: Val | CancelReason | null; isResolved: boolean; /** * @type {Array | null} */ _whenResolved: ((arg0: Val) => void)[] | null; /** * @type {Array | null} */ _whenCanceled: ((arg0: CancelReason) => void)[] | null; get isDone(): boolean; get isCanceled(): boolean; /** * @param {Val} v */ resolve(v: Val): void; /** * @param {CancelReason} reason */ cancel(reason: CancelReason): void; /** * @template R * @param {function(Val):Pledge} f * @return {PledgeInstance} */ map(f: (arg0: Val) => Pledge): PledgeInstance; /** * @param {function(Val):void} f */ whenResolved(f: (arg0: Val) => void): void; /** * @param {(reason: CancelReason) => void} f */ whenCanceled(f: (reason: CancelReason) => void): void; /** * @return {Promise} */ promise(): Promise; } export function create(): PledgeInstance; export function createWithDependencies(init: (p: PledgeInstance, ...deps: Resolved) => void, ...deps: DEPS): PledgeInstance; export function whenResolved(p: Pledge, f: (arg0: R) => void): void; export function whenCanceled

(p: P, f: P extends PledgeInstance ? (arg0: CancelReason) => void : (arg0: any) => void): void; export function map(p: Pledge

, f: (r: P) => Q): Pledge; export function all(ps: PS): PledgeInstance, Error>; export function coroutine(f: () => Generator | PledgeInstance, Result, any>): PledgeInstance; export function wait(timeout: number): PledgeInstance; export type Pledge = V | PledgeInstance; export type PledgeMap = Array> | { [x: string]: Pledge; }; /** *

*/ export type Resolved

= P extends PledgeMap ? P extends infer T extends PledgeMap ? { [K in keyof T]: P[K] extends Pledge ? V : P[K]; } : never : P extends Pledge ? V_1 : never; //# sourceMappingURL=pledge.d.ts.map