From: Ardis Lu Date: Sun, 25 May 2025 04:55:24 +0000 (-0700) Subject: Explicitly import `ReadableStream` to make TS understand `ReadableStream.from` X-Git-Tag: v0.1.0~15 X-Git-Url: https://git.ardis.lu/?a=commitdiff_plain;h=fb605b5cee09c5ef3fddff28978fde89ac8cf5c7;p=csvio 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. --- 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';