@types/async 3.2.12 → 3.2.15

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 +32 -11
  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: Sun, 26 Dec 2021 12:01:22 GMT
11
+ * Last updated: Wed, 06 Jul 2022 10:02:22 GMT
12
12
  * Dependencies: none
13
13
  * Global values: `async`
14
14
 
async/index.d.ts CHANGED
@@ -22,6 +22,7 @@ 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; }
@@ -292,35 +293,52 @@ export const selectLimit: typeof filterLimit;
292
293
  export const reject: typeof filter;
293
294
  export const rejectSeries: typeof filter;
294
295
  export const rejectLimit: typeof filterLimit;
295
- 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>;
296
298
  export const inject: typeof reduce;
297
299
  export const foldl: typeof reduce;
298
300
  export const reduceRight: typeof reduce;
299
301
  export const foldr: typeof reduce;
300
- 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>;
301
304
  export const detectSeries: typeof detect;
302
- export function detectLimit<T, E = Error>(arr: IterableCollection<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultCallback<T, E>): void;
305
+ export function detectLimit<T, E = Error>(arr: IterableCollection<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback: AsyncResultCallback<T, E>): void;
306
+ export function detectLimit<T, E = Error>(arr: IterableCollection<T>, limit: number, iterator: AsyncBooleanIterator<T, E>): Promise<T>;
303
307
  export const find: typeof detect;
304
308
  export const findSeries: typeof detect;
305
309
  export const findLimit: typeof detectLimit;
306
- export function sortBy<T, V, E = Error>(arr: T[] | IterableIterator<T>, iterator: AsyncResultIterator<T, V, E>, callback?: AsyncResultArrayCallback<T, E>): void;
310
+ export function sortBy<T, V, E = Error>(arr: T[] | IterableIterator<T>, iterator: AsyncResultIterator<T, V, E>, callback: AsyncResultArrayCallback<T, E>): void;
311
+ export function sortBy<T, V, E = Error>(arr: T[] | IterableIterator<T>, iterator: AsyncResultIterator<T, V, E>):
312
+ Promise<T[]>;
307
313
  export function some<T, E = Error>(arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
308
314
  export const someSeries: typeof some;
309
315
  export function someLimit<T, E = Error>(arr: IterableCollection<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
310
316
  export const any: typeof some;
311
317
  export const anySeries: typeof someSeries;
312
318
  export const anyLimit: typeof someLimit;
313
- export function every<T, E = Error>(arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
319
+ export function every<T, E = Error>(arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>, callback: AsyncBooleanResultCallback<E>): void;
320
+ export function every<T, E = Error>(arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>): Promise<boolean>;
314
321
  export const everySeries: typeof every;
315
- export function everyLimit<T, E = Error>(arr: IterableCollection<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
322
+ export function everyLimit<T, E = Error>(arr: IterableCollection<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback: AsyncBooleanResultCallback<E>): void;
323
+ export function everyLimit<T, E = Error>(arr: IterableCollection<T>, limit: number, iterator: AsyncBooleanIterator<T, E>): Promise<boolean>;
316
324
  export const all: typeof every;
317
325
  export const allSeries: typeof every;
318
326
  export const allLimit: typeof everyLimit;
319
327
 
320
- export function concat<T, R, E = Error>(arr: IterableCollection<T>, iterator: AsyncResultIterator<T, R[], E>, callback?: AsyncResultArrayCallback<R, E>): void;
328
+ export function concat<T, R, E = Error>(arr: IterableCollection<T>, iterator: AsyncResultIterator<T, R[], E>, callback: AsyncResultArrayCallback<R, E>): void;
329
+ export function concat<T, R, E = Error>(arr: IterableCollection<T>, iterator: AsyncResultIterator<T, R[], E>): Promise<R[]>;
321
330
  export function concatLimit<T, R, E = Error>(arr: IterableCollection<T>, limit: number, iterator: AsyncResultIterator<T, R[], E>, callback: AsyncResultArrayCallback<R, E>): void;
322
331
  export function concatLimit<T, R, E = Error>(arr: IterableCollection<T>, limit: number, iterator: AsyncResultIterator<T, R[], E>): Promise<R[]>;
323
332
  export const concatSeries: typeof concat;
333
+ export const flatMap: typeof concat;
334
+ export const flatMapLimit: typeof concatLimit;
335
+ export const flatMapSeries: typeof concatSeries;
336
+
337
+ export function groupBy<T, K, E = Error>(iterable: IterableCollection<T>, iterator: AsyncResultIterator<T, K, E>, callback: AsyncResultCallback<Record<string, T[]>, E>): void;
338
+ export function groupBy<T, K, E = Error>(iterable: IterableCollection<T>, iterator: AsyncResultIterator<T, K, E>): Promise<Record<string, T[]>>;
339
+ export function groupByLimit<T, K, E = Error>(iterable: IterableCollection<T>, limit: number, iterator: AsyncResultIterator<T, K, E>, callback: AsyncResultCallback<Record<string, T[]>, E>): void;
340
+ export function groupByLimit<T, K, E = Error>(iterable: IterableCollection<T>, limit: number, iterator: AsyncResultIterator<T, K, E>): Promise<Record<string, T[]>>;
341
+ export const groupBySeries: typeof groupBy;
324
342
 
325
343
  // Control Flow
326
344
  export function series<T, E = Error>(tasks: Array<AsyncFunction<T, E>>, callback?: AsyncResultArrayCallback<T, E>): void;
@@ -336,7 +354,7 @@ export function parallelLimit<T, R, E = Error>(tasks: Array<AsyncFunction<T, E>>
336
354
  export function whilst<T, E = Error>(
337
355
  test: (cb: AsyncBooleanResultCallback) => void,
338
356
  fn: AsyncFunctionEx<T, E>,
339
- callback: AsyncFunctionEx<T, E>
357
+ callback: AsyncResultRestCallback<T, E>
340
358
  ): void;
341
359
  export function whilst<T, R, E = Error>(
342
360
  test: (cb: AsyncBooleanResultCallback) => void,
@@ -345,7 +363,7 @@ export function whilst<T, R, E = Error>(
345
363
  export function doWhilst<T, E = Error>(
346
364
  fn: AsyncFunctionEx<T, E>,
347
365
  test: (/* ...results: T[], */ cb: AsyncBooleanResultCallback) => void,
348
- callback: AsyncFunctionEx<T, E>
366
+ callback: AsyncResultRestCallback<T, E>
349
367
  ): void;
350
368
  export function doWhilst<T, R, E = Error>(
351
369
  fn: AsyncFunctionEx<T, E>,
@@ -354,7 +372,7 @@ export function doWhilst<T, R, E = Error>(
354
372
  export function until<T, E = Error>(
355
373
  test: (cb: AsyncBooleanResultCallback) => void,
356
374
  fn: AsyncFunctionEx<T, E>,
357
- callback: AsyncFunctionEx<T, E>
375
+ callback: AsyncResultRestCallback<T, E>
358
376
  ): void;
359
377
  export function until<T, R, E = Error>(
360
378
  test: (cb: AsyncBooleanResultCallback) => void,
@@ -363,7 +381,7 @@ export function until<T, R, E = Error>(
363
381
  export function doUntil<T, E = Error>(
364
382
  fn: AsyncFunctionEx<T, E>,
365
383
  test: (/* ...results: T[], */ cb: AsyncBooleanResultCallback) => void,
366
- callback: AsyncFunctionEx<T, E>
384
+ callback: AsyncResultRestCallback<T, E>
367
385
  ): void;
368
386
  export function doUntil<T, R, E = Error>(
369
387
  fn: AsyncFunctionEx<T, E>,
@@ -463,6 +481,9 @@ export function transform<T, R, E = Error>(
463
481
 
464
482
  export function race<T, E = Error>(tasks: Array<AsyncFunction<T, E>>, callback: AsyncResultCallback<T, E>): void;
465
483
 
484
+ export function tryEach<T, E = Error>(tasks: IterableCollection<AsyncFunction<T>>, callback: AsyncResultCallback<T, E>): void;
485
+ export function tryEach<T>(tasks: IterableCollection<AsyncFunction<T>>): Promise<T>;
486
+
466
487
  // Utils
467
488
  export function memoize(fn: Function, hasher?: Function): Function;
468
489
  export function unmemoize(fn: Function): Function;
async/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/async",
3
- "version": "3.2.12",
3
+ "version": "3.2.15",
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": "a14b6ee9ce4edbdcc61a907887cacbfbbd4e0f6ec63b045475e37be787ce4e65",
64
- "typeScriptVersion": "3.8"
63
+ "typesPublisherContentHash": "bbb8223de20daa7212242cc87e7884633b39451ecdc4548a2fa3491af982d801",
64
+ "typeScriptVersion": "4.0"
65
65
  }