From fb605b5cee09c5ef3fddff28978fde89ac8cf5c7 Mon Sep 17 00:00:00 2001 From: Ardis Lu Date: Sat, 24 May 2025 21:55:24 -0700 Subject: [PATCH] Explicitly import `ReadableStream` to make TS understand `ReadableStream.from` This change does not affect the code execution, but it makes the TS language server understand the `ReadableStream.from` static function. Without the explicit import, it is not possible using only JSDoc to merge the `ReadableStream` instance interface with the `ReadableStream` constructor because they share the same name. --- test/core.test.js | 1 + test/utils.js | 1 + 2 files changed, 2 insertions(+) diff --git a/test/core.test.js b/test/core.test.js index 0376d23..5f6dc8f 100644 --- a/test/core.test.js +++ b/test/core.test.js @@ -4,6 +4,7 @@ import { unlink } from 'node:fs/promises'; import { normalize, basename, resolve } from 'node:path'; import { setTimeout } from 'node:timers/promises'; import { pathToFileURL } from 'node:url'; +import { ReadableStream } from 'node:stream/web'; import { csvStreamEqualWritable, csvStreamNotEqualWritable, createCSVMockStream, createTempFile } from './utils.js'; import { parsePathLike, createFileStream, CSVReader, CSVTransformer, CSVWriter } from '../src/core.js'; diff --git a/test/utils.js b/test/utils.js index 1d804dc..b8fefec 100644 --- a/test/utils.js +++ b/test/utils.js @@ -2,6 +2,7 @@ import { deepStrictEqual, notStrictEqual, ok } from 'node:assert/strict'; import { tmpdir } from 'node:os'; import { mkdtemp, open } from 'node:fs/promises'; import { normalize } from 'node:path'; +import { ReadableStream } from 'node:stream/web'; /** @import { TestContext } from 'node:test'; */ import { utils } from '../src/errorStrategies.js'; -- 2.47.3