]> git.ardis.lu - csvio/commitdiff
Explicitly import `ReadableStream` to make TS understand `ReadableStream.from`
authorArdis Lu <ardisglu@gmail.com>
Sun, 25 May 2025 04:55:24 +0000 (21:55 -0700)
committerArdis Lu <ardisglu@gmail.com>
Sun, 25 May 2025 04:55:24 +0000 (21:55 -0700)
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
test/utils.js

index 0376d231232bddd3c41298b9d6814ff87e1b4337..5f6dc8fcc81a733d846deb3fcfc9f3185f40d13e 100644 (file)
@@ -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';
index 1d804dc79ea140901f368ecab2ab0970a2523ca6..b8fefecb9b1945021b102991624e54d62803963c 100644 (file)
@@ -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';
This page took 0.037118 seconds and 4 git commands to generate.