summaryrefslogtreecommitdiff
path: root/std/node/_stream/stream.ts
diff options
context:
space:
mode:
Diffstat (limited to 'std/node/_stream/stream.ts')
-rw-r--r--std/node/_stream/stream.ts6
1 files changed, 4 insertions, 2 deletions
diff --git a/std/node/_stream/stream.ts b/std/node/_stream/stream.ts
index 708b8bcd3..4daafc77b 100644
--- a/std/node/_stream/stream.ts
+++ b/std/node/_stream/stream.ts
@@ -1,6 +1,7 @@
// Copyright Node.js contributors. All rights reserved. MIT License.
import { Buffer } from "../buffer.ts";
import EventEmitter from "../events.ts";
+import type Readable from "./readable.ts";
import type Writable from "./writable.ts";
import { types } from "../util.ts";
@@ -12,7 +13,7 @@ class Stream extends EventEmitter {
static _isUint8Array = types.isUint8Array;
static _uint8ArrayToBuffer = (chunk: Uint8Array) => Buffer.from(chunk);
- pipe(dest: Writable, options: { end: boolean }) {
+ pipe(dest: Readable | Writable, options?: { end?: boolean }) {
// deno-lint-ignore no-this-alias
const source = this;
@@ -31,7 +32,8 @@ class Stream extends EventEmitter {
if (didOnEnd) return;
didOnEnd = true;
- dest.end();
+ // 'end' is only called on Writable streams
+ (dest as Writable).end();
}
function onclose() {