mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-13 05:20:25 +00:00
corrected: in async.queue.push(task,callback) callback is not called with the task interface. (#18821)
* correted: async.queue callback function does not use task interface. * correct `queue.push` generic type.
This commit is contained in:
Vendored
+3
-3
@@ -28,7 +28,7 @@ interface AsyncQueue<T> {
|
||||
idle(): boolean;
|
||||
concurrency: number;
|
||||
push<E>(task: T, callback?: ErrorCallback<E>): void;
|
||||
push<E>(task: T, callback?: AsyncResultCallback<T, E>): void;
|
||||
push<R,E>(task: T, callback?: AsyncResultCallback<R, E>): void;
|
||||
push<E>(task: T[], callback?: ErrorCallback<E>): void;
|
||||
unshift<E>(task: T, callback?: ErrorCallback<E>): void;
|
||||
unshift<E>(task: T[], callback?: ErrorCallback<E>): void;
|
||||
@@ -53,8 +53,8 @@ interface AsyncPriorityQueue<T> {
|
||||
concurrency: number;
|
||||
started: boolean;
|
||||
paused: boolean;
|
||||
push<E>(task: T, priority: number, callback?: AsyncResultArrayCallback<T, E>): void;
|
||||
push<E>(task: T[], priority: number, callback?: AsyncResultArrayCallback<T, E>): void;
|
||||
push<R,E>(task: T, priority: number, callback?: AsyncResultArrayCallback<R, E>): void;
|
||||
push<R,E>(task: T[], priority: number, callback?: AsyncResultArrayCallback<R, E>): void;
|
||||
saturated: () => any;
|
||||
empty: () => any;
|
||||
drain: () => any;
|
||||
|
||||
@@ -271,9 +271,9 @@ async.waterfall([
|
||||
], function (err, result) { });
|
||||
|
||||
|
||||
var q = async.queue<any,Error>(function (task: any, callback: () => void) {
|
||||
var q = async.queue<any,Error>(function (task: any, callback: (err?:Error,msg?:string) => void) {
|
||||
console.log('hello ' + task.name);
|
||||
callback();
|
||||
callback(undefined,'a message.');
|
||||
}, 2);
|
||||
|
||||
|
||||
@@ -291,6 +291,10 @@ q.push([{ name: 'baz' }, { name: 'bay' }, { name: 'bax' }], function (err) {
|
||||
console.log('finished processing bar');
|
||||
});
|
||||
|
||||
q.push<string,Error>({name: 'foo'}, function (err,msg) {
|
||||
console.log('foo finished with a message "'+ msg! + '"');
|
||||
});
|
||||
|
||||
q.unshift({ name: 'foo' });
|
||||
|
||||
q.unshift({ name: 'bar' }, function (err) {
|
||||
|
||||
Reference in New Issue
Block a user