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:
Jason 2019-05-13 18:18:59 -04:00 committed by Nathan Shively-Sanders
parent 8cebff3068
commit fcd45613c0
2 changed files with 6 additions and 4 deletions

View File

@ -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;

View File

@ -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')]);