/** * The signature of resolve function for Promise. */ export interface PromiseResolver { (val?: T): void; } /** * The signature of reject function for Promise. */ export interface PromiseRejector { (err: T): void; } /** * Type for the string-index dictionary object. */ export interface Dictionary { [key: string]: T; } /** * Type for the number-index dictionary object. */ export interface NumericDictionary { [key: number]: T; } /** * The signature of a no data bound asynchronous callback. */ export interface AsyncErrorCallback { (error?: E): void; } /** * The signature of a no data bound asynchronous callback. */ export interface RetryCallback { (error?: E, quit?: boolean): void; } /** * The signature of a data bound asynchronous callback. */ export interface SeriesNextCallback { (error?: E, ...args: any[]): void; } /** * The signature of simple functions for controlling callback. */ export interface SeriesFunction { (next: SeriesNextCallback, ...args: any[]): void; } /** * The signature of the iterator function of list.forEach. */ export interface ForEachIterator { (val: T, key: string | number, next: AsyncErrorCallback): void; } /** * The signature of the next callback function of list.map. */ export interface MapNextCallback { (error: E, val?: T): void; } /** * The signature of the result callback of list.map. */ export interface MapResultCallback { (error: E, vals?: Dictionary | T[]): void; } /** * The signature of the iterator function of list.map. */ export interface MapIterator { (val: T, key: string | number, next: MapNextCallback): void; } export interface ISetNextTick { (fn: Function, ...args: any[]): void; } /** * The signature of simple functions for controlling callback. */ export interface SimpleFunction { (next: AsyncErrorCallback): void; } export interface FlowNextCallback { (next: string, error?: E, ...args: any[]): void; } export interface FlowFunction { (next: FlowNextCallback, ...args: any[]): void; } export interface ParallelCallback { (err?: NumericDictionary): void; } export interface SyncConditionTester { (): boolean; } export interface BooleanCallback { (result: boolean): void; } export interface ConditionTester { (cb: BooleanCallback): void; } /** * The signature for worker function of retry. * * The second parameter tells the sequence for retrying. * And sequence === 0 means the first time before retrying. */ export interface RetryWorker { (next: RetryCallback, sequence: number): void; } export type RepeatWorker = RetryWorker;