From fa4578fa74c413cf5cd10398cd6f5c4be323da80 Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Thu, 7 Jun 2018 22:21:40 +0200 Subject: [PATCH] desiredSize is null when stream is errored --- types/whatwg-streams/index.d.ts | 6 +++--- types/whatwg-streams/whatwg-streams-tests.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/types/whatwg-streams/index.d.ts b/types/whatwg-streams/index.d.ts index e2487d438d..cadcf346ca 100644 --- a/types/whatwg-streams/index.d.ts +++ b/types/whatwg-streams/index.d.ts @@ -71,7 +71,7 @@ declare class ReadableStreamBYOBReader { } declare class ReadableStreamDefaultController { - readonly desiredSize: number; + readonly desiredSize: number | null; close(): void; enqueue(chunk: R): void; @@ -80,7 +80,7 @@ declare class ReadableStreamDefaultController { declare class ReadableByteStreamController { readonly byobRequest: ReadableStreamBYOBRequest; - readonly desiredSize: number; + readonly desiredSize: number | null; close(): void; enqueue(chunk: R): void; @@ -157,5 +157,5 @@ declare class TransformStreamDefaultController { error(reason: any): void; terminate(): void; - readonly desiredSize: number; + readonly desiredSize: number | null; } diff --git a/types/whatwg-streams/whatwg-streams-tests.ts b/types/whatwg-streams/whatwg-streams-tests.ts index 56246e0d97..c6e83a89d3 100644 --- a/types/whatwg-streams/whatwg-streams-tests.ts +++ b/types/whatwg-streams/whatwg-streams-tests.ts @@ -48,7 +48,7 @@ function makeReadableBackpressureSocketStream(host: string, port: number) { socket.ondata = (event: any) => { controller.enqueue(event.data); - if (controller.desiredSize <= 0) { + if (controller.desiredSize! <= 0) { // The internal queue is full, so propagate // the backpressure signal to the underlying source. socket.readStop();