mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
pump: pump should return a single stream instead of an array. (#35238)
* Pump signature now returns a single stream instead of an array of streams. * pump: Updates version and adds author
This commit is contained in:
parent
8cebff3068
commit
fcd45613c0
8
types/pump/index.d.ts
vendored
8
types/pump/index.d.ts
vendored
@ -1,14 +1,14 @@
|
||||
// Type definitions for pump 1.0
|
||||
// Type definitions for pump 1.1
|
||||
// Project: https://github.com/mafintosh/pump
|
||||
// Definitions by: Tomek Łaziuk <https://github.com/tlaziuk>
|
||||
// Definitions by: Tomek Łaziuk <https://github.com/tlaziuk>, Jason Cordial <https://github.com/jcordial>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
declare function pump(streams: pump.Stream[], callback?: pump.Callback): pump.Stream[];
|
||||
declare function pump(streams: pump.Stream[], callback?: pump.Callback): pump.Stream;
|
||||
|
||||
// callback have to be passed as last argument
|
||||
declare function pump(...streams: Array<pump.Stream | pump.Callback>): pump.Stream[];
|
||||
declare function pump(...streams: Array<pump.Stream | pump.Callback>): pump.Stream;
|
||||
|
||||
declare namespace pump {
|
||||
type Callback = (err: Error) => any;
|
||||
|
||||
@ -47,6 +47,8 @@ setTimeout(() => {
|
||||
throw new Error('timeout');
|
||||
}, 5000);
|
||||
|
||||
// $ExpectType Stream
|
||||
pump(createReadStream('/dev/random'), toHex(), createWriteStream('/dev/null'));
|
||||
|
||||
// $ExpectType Stream
|
||||
pump([createReadStream('/dev/random'), toHex(), createWriteStream('/dev/null')]);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user