Skip to content

Commit

Permalink
Merge pull request #14 from ChristopherChudzicki/improve-batch-typings
Browse files Browse the repository at this point in the history
Make batch method generic, similiar to Promise.all
  • Loading branch information
vitaly-t authored Dec 20, 2020
2 parents 8166945 + 169abe3 commit 0d708c1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion typescript/spex.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,16 @@ declare namespace spex {
interface ISpexBase {

// API: http://vitaly-t.github.io/spex/global.html#batch
batch(values: Array<any>, options?: { cb?: (index: number, success: boolean, result: any, delay: number) => any }): Promise<IArrayExt<any>>;
batch<T>(values: (T | Promise<T>)[], options?: { cb?: (index: number, success: boolean, result: any, delay: number) => any}): Promise<IArrayExt<T>>;
batch<T1, T2>(values: [T1 | Promise<T1>, T2 | Promise<T2>], options?: { cb?: (index: number, success: boolean, result: any, delay: number) => any }): Promise<[T1, T2] & IArrayExt<T1 | T2>>;
batch<T1, T2, T3>(values: [T1 | Promise<T1>, T2 | Promise<T2>, T3 | Promise<T3>], options?: { cb?: (index: number, success: boolean, result: any, delay: number) => any }): Promise<[T1, T2, T3] & IArrayExt<T1 | T2 | T3>>;
batch<T1, T2, T3, T4>(values: [T1 | Promise<T1>, T2 | Promise<T2>, T3 | Promise<T3>, T4 | Promise<T4>], options?: { cb?: (index: number, success: boolean, result: any, delay: number) => any }): Promise<[T1, T2, T3, T4] & IArrayExt<T1 | T2 | T3 | T4>>;
batch<T1, T2, T3, T4, T5>(values: [T1 | Promise<T1>, T2 | Promise<T2>, T3 | Promise<T3>, T4 | Promise<T4>, T5 | Promise<T5>], options?: { cb?: (index: number, success: boolean, result: any, delay: number) => any }): Promise<[T1, T2, T3, T4, T5] & IArrayExt<T1 | T2 | T3 | T4 | T5>>;
batch<T1, T2, T3, T4, T5, T6>(values: [T1 | Promise<T1>, T2 | Promise<T2>, T3 | Promise<T3>, T4 | Promise<T4>, T5 | Promise<T5>, T6 | Promise<T6>], options?: { cb?: (index: number, success: boolean, result: any, delay: number) => any }): Promise<[T1, T2, T3, T4, T5, T6] & IArrayExt<T1 | T2 | T3 | T4 | T5 | T6>>;
batch<T1, T2, T3, T4, T5, T6, T7>(values: [T1 | Promise<T1>, T2 | Promise<T2>, T3 | Promise<T3>, T4 | Promise<T4>, T5 | Promise<T5>, T6 | Promise<T6>, T7 | Promise<T7>], options?: { cb?: (index: number, success: boolean, result: any, delay: number) => any }): Promise<[T1, T2, T3, T4, T5, T6, T7] & IArrayExt<T1 | T2 | T3 | T4 | T5 | T6 | T7>>;
batch<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | Promise<T1>, T2 | Promise<T2>, T3 | Promise<T3>, T4 | Promise<T4>, T5 | Promise<T5>, T6 | Promise<T6>, T7 | Promise<T7>, T8 | Promise<T8>], options?: { cb?: (index: number, success: boolean, result: any, delay: number) => any }): Promise<[T1, T2, T3, T4, T5, T6, T7, T8] & IArrayExt<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8>>;
batch<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | Promise<T1>, T2 | Promise<T2>, T3 | Promise<T3>, T4 | Promise<T4>, T5 | Promise<T5>, T6 | Promise<T6>, T7 | Promise<T7>, T8 | Promise<T8>, T9 | Promise<T9>], options?: { cb?: (index: number, success: boolean, result: any, delay: number) => any }): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9] & IArrayExt<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9>>;
batch<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1 | Promise<T1>, T2 | Promise<T2>, T3 | Promise<T3>, T4 | Promise<T4>, T5 | Promise<T5>, T6 | Promise<T6>, T7 | Promise<T7>, T8 | Promise<T8>, T9 | Promise<T9>, T10 | Promise<T10>], options?: { cb?: (index: number, success: boolean, result: any, delay: number) => any }): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10] & IArrayExt<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9 | T10>>;

// API: http://vitaly-t.github.io/spex/global.html#page
page(source: (index: number, data: any, delay: number) => any, options?: { dest?: (index: number, data: any, delay: number) => any, limit?: number }): Promise<IPageResult>;
Expand Down

0 comments on commit 0d708c1

Please sign in to comment.