diff --git a/async/async-tests.ts b/async/async-tests.ts index a6b041b4d5..4fddea875c 100644 --- a/async/async-tests.ts +++ b/async/async-tests.ts @@ -106,6 +106,17 @@ async.series({ }, function (err, results) { }); +async.times(5, function(n, next) { + next(null, n) +}, function(err, results) { + console.log(results) +}) + +async.timesSeries(5, function(n, next) { + next(null, n) +}, function(err, results) { + console.log(results) +}) async.parallel([ function (callback) { diff --git a/async/async.d.ts b/async/async.d.ts index bb8890ef78..475191aaf2 100644 --- a/async/async.d.ts +++ b/async/async.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Async 0.1.23 +// Type definitions for Async 0.9.2 // Project: https://github.com/caolan/async // Definitions by: Boris Yankov // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -9,7 +9,6 @@ interface ErrorCallback { (err?: Error): void; } interface AsyncResultCallback { (err: Error, result: T): void; } interface AsyncResultArrayCallback { (err: Error, results: T[]): void; } interface AsyncResultObjectCallback { (err: Error, results: Dictionary): void; } -interface AsyncTimesCallback { (n: number, callback: AsyncResultArrayCallback): void; } interface AsyncIterator { (item: T, callback: ErrorCallback): void; } interface AsyncResultIterator { (item: T, callback: AsyncResultCallback): void; } @@ -105,8 +104,8 @@ interface Async { apply(fn: Function, ...arguments: any[]): AsyncFunction; nextTick(callback: Function): void; - times (n: number, callback: AsyncTimesCallback): void; - timesSeries (n: number, callback: AsyncTimesCallback): void; + times (n: number, iterator: AsyncResultIterator, callback: AsyncResultArrayCallback): void; + timesSeries (n: number, iterator: AsyncResultIterator, callback: AsyncResultArrayCallback): void; // Utils memoize(fn: Function, hasher?: Function): Function; diff --git a/async/tsconfig.json b/async/tsconfig.json new file mode 100644 index 0000000000..be6fd95cc4 --- /dev/null +++ b/async/tsconfig.json @@ -0,0 +1,21 @@ +{ + "version": "1.4.1", + "compilerOptions": { + "target": "es5", + "module": "commonjs", + "declaration": false, + "noImplicitAny": false, + "removeComments": true, + "noLib": false + }, + "filesGlob": [ + "./**/*.ts", + "!./node_modules/**/*.ts" + ], + "files": [ + "./async-explicit-tests.ts", + "./async-tests.ts", + "./async.d.ts", + "./asyncamd-tests.ts" + ] +} \ No newline at end of file