From 3c75ef88b49909d869c5c91f0fc36ad8bc48d02e Mon Sep 17 00:00:00 2001 From: Jerry Kurian Date: Mon, 11 May 2020 21:13:03 -0400 Subject: [PATCH] Minor changes to types --- src/functions/demux.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/functions/demux.ts b/src/functions/demux.ts index ac1a62a..fdc9063 100644 --- a/src/functions/demux.ts +++ b/src/functions/demux.ts @@ -12,7 +12,7 @@ export function demux( pipelineConstructor: ( destKey?: string, chunk?: any, - ) => DemuxStreams | Array, + ) => DemuxStreams | DemuxStreams[], demuxBy: string | ((chunk: any) => string), options?: DemuxOptions, ): Duplex { @@ -21,20 +21,20 @@ export function demux( class Demux extends Duplex { private streamsByKey: { - [key: string]: Array; + [key: string]: DemuxStreams[]; }; private demuxer: (chunk: any) => string; private pipelineConstructor: ( destKey?: string, chunk?: any, - ) => Array; + ) => DemuxStreams[]; private remultiplex: boolean; private transform: Transform; constructor( pipelineConstructor: ( destKey?: string, chunk?: any, - ) => DemuxStreams | Array, + ) => DemuxStreams | DemuxStreams[], demuxBy: string | ((chunk: any) => string), options: DemuxOptions = {}, ) { @@ -81,7 +81,7 @@ class Demux extends Duplex { }); } const pipelines = this.streamsByKey[destKey]; - let pendingDrains: Array> = []; + const pendingDrains: Array> = []; pipelines.forEach(pipeline => { if (!pipeline.write(chunk, encoding)) { @@ -99,7 +99,7 @@ class Demux extends Duplex { } public _flush() { - const pipelines: Array = [].concat.apply( + const pipelines: DemuxStreams[] = [].concat.apply( [], Object.values(this.streamsByKey), ); @@ -121,7 +121,7 @@ class Demux extends Duplex { } public _destroy(error: any, cb: (error?: any) => void) { - const pipelines: Array = [].concat.apply( + const pipelines: DemuxStreams[] = [].concat.apply( [], Object.values(this.streamsByKey), );