mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Add types for map functions with promise return (#38294)
When no callback is passed, the function should return a promise (since version 3.0.0) https://github.com/caolan/async/blob/master/CHANGELOG.md#v300
This commit is contained in:
parent
3889492dec
commit
04d87f9e90
12
types/async/index.d.ts
vendored
12
types/async/index.d.ts
vendored
@ -126,9 +126,11 @@ export function forEachOfLimit<T, E = Error>(obj: IterableCollection<T>, limit:
|
||||
export const eachOf: typeof forEachOf;
|
||||
export const eachOfSeries: typeof forEachOf;
|
||||
export const eachOfLimit: typeof forEachOfLimit;
|
||||
export function map<T, R, E = Error>(arr: T[] | IterableIterator<T> | Dictionary<T>, iterator: AsyncResultIterator<T, R, E>, callback?: AsyncResultArrayCallback<R, E>): void;
|
||||
export function map<T, R, E = Error>(arr: T[] | IterableIterator<T> | Dictionary<T>, iterator: AsyncResultIterator<T, R, E>, callback: AsyncResultArrayCallback<R, E>): void;
|
||||
export function map<T, R, E = Error>(arr: T[] | IterableIterator<T> | Dictionary<T>, iterator: AsyncResultIterator<T, R, E>): Promise<R>;
|
||||
export const mapSeries: typeof map;
|
||||
export function mapLimit<T, R, E = Error>(arr: IterableCollection<T>, limit: number, iterator: AsyncResultIterator<T, R, E>, callback?: AsyncResultArrayCallback<R, E>): void;
|
||||
export function mapLimit<T, R, E = Error>(arr: IterableCollection<T>, limit: number, iterator: AsyncResultIterator<T, R, E>, callback: AsyncResultArrayCallback<R, E>): void;
|
||||
export function mapLimit<T, R, E = Error>(arr: IterableCollection<T>, limit: number, iterator: AsyncResultIterator<T, R, E>): Promise<R>;
|
||||
|
||||
export function mapValuesLimit<T, R, E = Error>(
|
||||
obj: Dictionary<T>,
|
||||
@ -136,8 +138,14 @@ export function mapValuesLimit<T, R, E = Error>(
|
||||
iteratee: (value: T, key: string, callback: AsyncResultCallback<R, E>) => void,
|
||||
callback: AsyncResultObjectCallback<R, E>
|
||||
): void;
|
||||
export function mapValuesLimit<T, R, E = Error>(
|
||||
obj: Dictionary<T>,
|
||||
limit: number,
|
||||
iteratee: (value: T, key: string, callback: AsyncResultCallback<R, E>) => void
|
||||
): Promise<R>;
|
||||
|
||||
export function mapValues<T, R, E = Error>(obj: Dictionary<T>, iteratee: (value: T, key: string, callback: AsyncResultCallback<R, E>) => void, callback: AsyncResultObjectCallback<R, E>): void;
|
||||
export function mapValues<T, R, E = Error>(obj: Dictionary<T>, iteratee: (value: T, key: string, callback: AsyncResultCallback<R, E>) => void): Promise<R>;
|
||||
export const mapValuesSeries: typeof mapValues;
|
||||
export function filter<T, E = Error>(arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultArrayCallback<T, E>): void;
|
||||
export const filterSeries: typeof filter;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user