@types/async 3.2.11 → 3.2.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. async/README.md +1 -1
  2. async/index.d.ts +45 -15
  3. async/package.json +3 -3
async/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for Async (https://github.com/caolan/asyn
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/async.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Thu, 23 Dec 2021 23:34:16 GMT
11
+ * Last updated: Tue, 28 Jun 2022 00:31:38 GMT
12
12
  * Dependencies: none
13
13
  * Global values: `async`
14
14
 
async/index.d.ts CHANGED
@@ -22,12 +22,14 @@ export interface AsyncBooleanResultCallback<E = Error> { (err?: E | null, truthV
22
22
  export interface AsyncResultCallback<T, E = Error> { (err?: E | null, result?: T): void; }
23
23
  export interface AsyncResultArrayCallback<T, E = Error> { (err?: E | null, results?: Array<T | undefined>): void; }
24
24
  export interface AsyncResultObjectCallback<T, E = Error> { (err: E | undefined, results: Dictionary<T | undefined>): void; }
25
+ export interface AsyncResultRestCallback<T, E = Error> { (err?: E | null, ...results: T[]): void; }
25
26
 
26
27
  export interface AsyncFunction<T, E = Error> { (callback: (err?: E | null, result?: T) => void): void; }
27
28
  export interface AsyncFunctionEx<T, E = Error> { (callback: (err?: E | null, ...results: T[]) => void): void; }
28
29
  export interface AsyncIterator<T, E = Error> { (item: T, callback: ErrorCallback<E>): void; }
29
30
  export interface AsyncForEachOfIterator<T, E = Error> { (item: T, key: number|string, callback: ErrorCallback<E>): void; }
30
31
  export interface AsyncResultIterator<T, R, E = Error> { (item: T, callback: AsyncResultCallback<R, E>): void; }
32
+ export interface AsyncResultIteratorPromise<T, R> { (item: T): Promise<R>; }
31
33
  export interface AsyncMemoIterator<T, R, E = Error> { (memo: R | undefined, item: T, callback: AsyncResultCallback<R, E>): void; }
32
34
  export interface AsyncBooleanIterator<T, E = Error> { (item: T, callback: AsyncBooleanResultCallback<E>): void; }
33
35
 
@@ -244,11 +246,26 @@ export function forEachOfLimit<T, E = Error>(obj: IterableCollection<T>, limit:
244
246
  export const eachOf: typeof forEachOf;
245
247
  export const eachOfSeries: typeof forEachOf;
246
248
  export const eachOfLimit: typeof forEachOfLimit;
247
- export function map<T, R, E = Error>(arr: T[] | IterableIterator<T> | Dictionary<T>, iterator: AsyncResultIterator<T, R, E>, callback: AsyncResultArrayCallback<R, E>): void;
248
- export function map<T, R, E = Error>(arr: T[] | IterableIterator<T> | Dictionary<T>, iterator: AsyncResultIterator<T, R, E>): Promise<R[]>;
249
+ export function map<T, R, E = Error>(
250
+ arr: T[] | IterableIterator<T> | Dictionary<T>,
251
+ iterator: (AsyncResultIterator<T, R, E> | AsyncResultIteratorPromise<T, R>),
252
+ callback: AsyncResultArrayCallback<R, E>
253
+ ): void;
254
+ export function map<T, R, E = Error>(
255
+ arr: T[] | IterableIterator<T> | Dictionary<T>,
256
+ iterator: (AsyncResultIterator<T, R, E> | AsyncResultIteratorPromise<T, R>)
257
+ ): Promise<R[]>;
258
+
249
259
  export const mapSeries: typeof map;
250
- export function mapLimit<T, R, E = Error>(arr: IterableCollection<T>, limit: number, iterator: AsyncResultIterator<T, R, E>, callback: AsyncResultArrayCallback<R, E>): void;
251
- export function mapLimit<T, R, E = Error>(arr: IterableCollection<T>, limit: number, iterator: AsyncResultIterator<T, R, E>): Promise<R[]>;
260
+ export function mapLimit<T, R, E = Error>(
261
+ arr: IterableCollection<T>,
262
+ limit: number, iterator: (AsyncResultIterator<T, R, E> | AsyncResultIteratorPromise<T, R>),
263
+ callback: AsyncResultArrayCallback<R, E>
264
+ ): void;
265
+ export function mapLimit<T, R, E = Error>(
266
+ arr: IterableCollection<T>,
267
+ limit: number, iterator: (AsyncResultIterator<T, R, E> | AsyncResultIteratorPromise<T, R>)
268
+ ): Promise<R[]>;
252
269
 
253
270
  export function mapValuesLimit<T, R, E = Error>(
254
271
  obj: Dictionary<T>,
@@ -276,12 +293,14 @@ export const selectLimit: typeof filterLimit;
276
293
  export const reject: typeof filter;
277
294
  export const rejectSeries: typeof filter;
278
295
  export const rejectLimit: typeof filterLimit;
279
- export function reduce<T, R, E = Error>(arr: T[] | IterableIterator<T>, memo: R, iterator: AsyncMemoIterator<T, R, E>, callback?: AsyncResultCallback<R, E>): void;
296
+ export function reduce<T, R, E = Error>(arr: T[] | IterableIterator<T>, memo: R, iterator: AsyncMemoIterator<T, R, E>, callback: AsyncResultCallback<R, E>): void;
297
+ export function reduce<T, R, E = Error>(arr: T[] | IterableIterator<T>, memo: R, iterator: AsyncMemoIterator<T, R, E>): Promise<R>;
280
298
  export const inject: typeof reduce;
281
299
  export const foldl: typeof reduce;
282
300
  export const reduceRight: typeof reduce;
283
301
  export const foldr: typeof reduce;
284
- export function detect<T, E = Error>(arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultCallback<T, E>): void;
302
+ export function detect<T, E = Error>(arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>, callback: AsyncResultCallback<T, E>): void;
303
+ export function detect<T, E = Error>(arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>): Promise<T>;
285
304
  export const detectSeries: typeof detect;
286
305
  export function detectLimit<T, E = Error>(arr: IterableCollection<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultCallback<T, E>): void;
287
306
  export const find: typeof detect;
@@ -301,7 +320,8 @@ export const all: typeof every;
301
320
  export const allSeries: typeof every;
302
321
  export const allLimit: typeof everyLimit;
303
322
 
304
- export function concat<T, R, E = Error>(arr: IterableCollection<T>, iterator: AsyncResultIterator<T, R[], E>, callback?: AsyncResultArrayCallback<R, E>): void;
323
+ export function concat<T, R, E = Error>(arr: IterableCollection<T>, iterator: AsyncResultIterator<T, R[], E>, callback: AsyncResultArrayCallback<R, E>): void;
324
+ export function concat<T, R, E = Error>(arr: IterableCollection<T>, iterator: AsyncResultIterator<T, R[], E>): Promise<R[]>;
305
325
  export function concatLimit<T, R, E = Error>(arr: IterableCollection<T>, limit: number, iterator: AsyncResultIterator<T, R[], E>, callback: AsyncResultArrayCallback<R, E>): void;
306
326
  export function concatLimit<T, R, E = Error>(arr: IterableCollection<T>, limit: number, iterator: AsyncResultIterator<T, R[], E>): Promise<R[]>;
307
327
  export const concatSeries: typeof concat;
@@ -320,7 +340,7 @@ export function parallelLimit<T, R, E = Error>(tasks: Array<AsyncFunction<T, E>>
320
340
  export function whilst<T, E = Error>(
321
341
  test: (cb: AsyncBooleanResultCallback) => void,
322
342
  fn: AsyncFunctionEx<T, E>,
323
- callback: AsyncFunctionEx<T, E>
343
+ callback: AsyncResultRestCallback<T, E>
324
344
  ): void;
325
345
  export function whilst<T, R, E = Error>(
326
346
  test: (cb: AsyncBooleanResultCallback) => void,
@@ -329,7 +349,7 @@ export function whilst<T, R, E = Error>(
329
349
  export function doWhilst<T, E = Error>(
330
350
  fn: AsyncFunctionEx<T, E>,
331
351
  test: (/* ...results: T[], */ cb: AsyncBooleanResultCallback) => void,
332
- callback: AsyncFunctionEx<T, E>
352
+ callback: AsyncResultRestCallback<T, E>
333
353
  ): void;
334
354
  export function doWhilst<T, R, E = Error>(
335
355
  fn: AsyncFunctionEx<T, E>,
@@ -338,7 +358,7 @@ export function doWhilst<T, R, E = Error>(
338
358
  export function until<T, E = Error>(
339
359
  test: (cb: AsyncBooleanResultCallback) => void,
340
360
  fn: AsyncFunctionEx<T, E>,
341
- callback: AsyncFunctionEx<T, E>
361
+ callback: AsyncResultRestCallback<T, E>
342
362
  ): void;
343
363
  export function until<T, R, E = Error>(
344
364
  test: (cb: AsyncBooleanResultCallback) => void,
@@ -347,7 +367,7 @@ export function until<T, R, E = Error>(
347
367
  export function doUntil<T, E = Error>(
348
368
  fn: AsyncFunctionEx<T, E>,
349
369
  test: (/* ...results: T[], */ cb: AsyncBooleanResultCallback) => void,
350
- callback: AsyncFunctionEx<T, E>
370
+ callback: AsyncResultRestCallback<T, E>
351
371
  ): void;
352
372
  export function doUntil<T, R, E = Error>(
353
373
  fn: AsyncFunctionEx<T, E>,
@@ -413,11 +433,21 @@ export function reflectAll<T, E = Error>(tasks: Array<AsyncFunction<T, E>>): Arr
413
433
  export function timeout<T, E = Error>(fn: AsyncFunction<T, E>, milliseconds: number, info?: any): AsyncFunction<T, E>;
414
434
  export function timeout<T, R, E = Error>(fn: AsyncResultIterator<T, R, E>, milliseconds: number, info?: any): AsyncResultIterator<T, R, E>;
415
435
 
416
- export function times<T, E = Error>(n: number, iterator: AsyncResultIterator<number, T, E>, callback: AsyncResultArrayCallback<T, E>): void;
417
- export function times<T, E = Error>(n: number, iterator: AsyncResultIterator<number, T, E>): Promise<T>;
436
+ export function times<T, E = Error>(n: number, iterator: (AsyncResultIterator<number, T, E> | AsyncResultIteratorPromise<number, T>), callback: AsyncResultArrayCallback<T, E>): void;
437
+ export function times<T, E = Error>(n: number, iterator: (AsyncResultIterator<number, T, E> | AsyncResultIteratorPromise<number, T>)): Promise<T>;
438
+
418
439
  export const timesSeries: typeof times;
419
- export function timesLimit<T, E = Error>(n: number, limit: number, iterator: AsyncResultIterator<number, T, E>, callback: AsyncResultArrayCallback<T, E>): void;
420
- export function timesLimit<T, E = Error>(n: number, limit: number, iterator: AsyncResultIterator<number, T, E>): Promise<T>;
440
+ export function timesLimit<T, E = Error>(
441
+ n: number,
442
+ limit: number,
443
+ iterator: (AsyncResultIterator<number, T, E> | AsyncResultIteratorPromise<number, T>),
444
+ callback: AsyncResultArrayCallback<T, E>
445
+ ): void;
446
+ export function timesLimit<T, E = Error>(
447
+ n: number,
448
+ limit: number,
449
+ iterator: (AsyncResultIterator<number, T, E> | AsyncResultIteratorPromise<number, T>)
450
+ ): Promise<T>;
421
451
 
422
452
  export function transform<T, R, E = Error>(arr: T[], iteratee: (acc: R[], item: T, key: number, callback: (error?: E) => void) => void, callback?: AsyncResultArrayCallback<T, E>): void;
423
453
  export function transform<T, R, E = Error>(arr: T[], acc: R[], iteratee: (acc: R[], item: T, key: number, callback: (error?: E) => void) => void, callback?: AsyncResultArrayCallback<T, E>): void;
async/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/async",
3
- "version": "3.2.11",
3
+ "version": "3.2.14",
4
4
  "description": "TypeScript definitions for Async",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/async",
6
6
  "license": "MIT",
@@ -60,6 +60,6 @@
60
60
  },
61
61
  "scripts": {},
62
62
  "dependencies": {},
63
- "typesPublisherContentHash": "a84804e41d003d56b766481633495eb03d525b60ec3e3cb24da339ce3492108e",
64
- "typeScriptVersion": "3.8"
63
+ "typesPublisherContentHash": "96d9c2e81a18d5af2a2879d63903b4884278d5c8517d02f4dbc32370afe6dfee",
64
+ "typeScriptVersion": "4.0"
65
65
  }