'use strict' /* ----------------------------------------------------------------------------- * Promise * -------------------------------------------------------------------------- */ export type PromiseResolve = ( value?: Value | PromiseLike ) => void export type PromiseReject = (reason?: any) => void export type PromiseExecutor = ( resolve: PromiseResolve, reject: PromiseReject ) => void export type PromiseOnFulfilled = | ((value: InputType) => OutputType | PromiseLike) | undefined | null export type PromiseOnRejected = | ((reason: any) => OutputType | PromiseLike) | undefined | null export type PromiseOnFinally = (() => void) | undefined | null export default class BasePromise { private _promise: Promise constructor (executor: PromiseExecutor) { this._promise = new Promise(executor) } then ( onfulfilled?: PromiseOnFulfilled, onrejected?: PromiseOnRejected ) { return this._promise.then(onfulfilled, onrejected) } catch (onrejected?: PromiseOnRejected) { return this._promise.catch(onrejected) } finally (onfinally?: PromiseOnFinally) { return this._promise.finally(onfinally) } }