fix(streams): tighten stream typings and guard optional runtime paths for duplex and wrapper utilities
This commit is contained in:
@@ -7,11 +7,11 @@ export interface IStreamTools {
|
||||
}
|
||||
|
||||
export interface IStreamWriteFunction<T, rT> {
|
||||
(chunkArg: T, toolsArg: IStreamTools): Promise<rT>;
|
||||
(chunkArg: T, toolsArg: IStreamTools): Promise<rT | void | null | undefined>;
|
||||
}
|
||||
|
||||
export interface IStreamFinalFunction<rT> {
|
||||
(toolsArg: IStreamTools): Promise<rT>;
|
||||
(toolsArg: IStreamTools): Promise<rT | void | null | undefined>;
|
||||
}
|
||||
|
||||
export interface ISmartDuplexOptions<TInput, TOutput> extends DuplexOptions {
|
||||
@@ -92,7 +92,7 @@ export class SmartDuplex<TInput = any, TOutput = any> extends Duplex {
|
||||
}
|
||||
|
||||
// INSTANCE
|
||||
private backpressuredArray: plugins.lik.BackpressuredArray<TOutput>;
|
||||
private backpressuredArray: plugins.lik.BackpressuredArray<TOutput | null>;
|
||||
public options: ISmartDuplexOptions<TInput, TOutput>;
|
||||
private _consumerWantsData = false;
|
||||
private _readFunctionRunning = false;
|
||||
@@ -114,7 +114,7 @@ export class SmartDuplex<TInput = any, TOutput = any> extends Duplex {
|
||||
)
|
||||
);
|
||||
this.options = safeOptions;
|
||||
this.backpressuredArray = new plugins.lik.BackpressuredArray<TOutput>(
|
||||
this.backpressuredArray = new plugins.lik.BackpressuredArray<TOutput | null>(
|
||||
this.options.highWaterMark || 1
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user