mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 14:57:10 +00:00
pumpify: add ctor args, duplexify members, tests (#25524)
* pumpify: add ctor args, duplexify members, tests * pumpify: add autoDestroy to PumpifyFactoryOptions
This commit is contained in:
committed by
Sheetal Nandi
parent
08e6b3d918
commit
e178856691
Vendored
+24
-6
@@ -1,17 +1,35 @@
|
||||
// Type definitions for pumpify 1.4
|
||||
// Project: https://github.com/mafintosh/pumpify
|
||||
// Definitions by: Justin Beckwith <https://github.com/JustinBeckwith>
|
||||
// Ankur Oberoi <https://github.com/aoberoi>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import { Stream, Duplex } from 'stream';
|
||||
import { Stream, Writable, Readable, Duplex } from 'stream';
|
||||
import * as duplexify from 'duplexify';
|
||||
|
||||
export = pumpify;
|
||||
declare class Pumpify extends Duplex implements duplexify.Duplexify {
|
||||
constructor(...streams: Stream[]);
|
||||
constructor(streams: Stream[]);
|
||||
setPipeline(...streams: Stream[]): void;
|
||||
setPipeline(streams: Stream[]): void;
|
||||
|
||||
declare class pumpify extends Duplex {
|
||||
constructor();
|
||||
setPipeline(...args: Stream[]): void;
|
||||
// Duplexify members
|
||||
setWritable(writable: Writable): void;
|
||||
setReadable(readable: Readable): void;
|
||||
}
|
||||
|
||||
declare namespace pumpify {}
|
||||
interface PumpifyFactoryOptions {
|
||||
autoDestroy: boolean;
|
||||
destroy: boolean;
|
||||
objectMode: boolean;
|
||||
highWaterMark: number;
|
||||
}
|
||||
|
||||
declare namespace Pumpify {
|
||||
let obj: typeof Pumpify;
|
||||
function ctor(opts: PumpifyFactoryOptions): typeof Pumpify;
|
||||
}
|
||||
|
||||
export = Pumpify;
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
import pumpify from 'pumpify';
|
||||
import { Duplex, Transform, PassThrough } from 'stream';
|
||||
import * as Pumpify from 'pumpify';
|
||||
import { Duplex, Transform, PassThrough, Writable } from 'stream';
|
||||
|
||||
class Pumpy extends pumpify {
|
||||
new Pumpify();
|
||||
new Pumpify(new Writable(), new Writable());
|
||||
const pumpify = new Pumpify([new Writable(), new Writable()]);
|
||||
|
||||
class Pumpy extends Pumpify {
|
||||
constructor() {
|
||||
super();
|
||||
const dup1 = new Duplex();
|
||||
@@ -12,3 +16,5 @@ class Pumpy extends pumpify {
|
||||
|
||||
const pumpy = new Pumpy();
|
||||
pumpy.pipe(new PassThrough());
|
||||
|
||||
pumpify.setPipeline(pumpy);
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
|
||||
Reference in New Issue
Block a user