Skip to content

Commit 8958342

Browse files
fix(studio-server): bridge the node web stream type for the Windows build (#3746)
tsc on the Windows jobs rejects a direct cast from node:stream/web's ReadableStream to the global one (TS2352), which broke the build after #3745. Cast through unknown, the bridge the error itself recommends.
1 parent 8825def commit 8958342

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎packages/studio-server/src/routes/preview.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,11 @@ export function registerPreviewRoutes(api: Hono, adapter: PreviewApiAdapter): vo
592592
const bodyFor = (start: number, end: number): BodyInit =>
593593
textBuffer
594594
? new Uint8Array(textBuffer.subarray(start, end + 1))
595-
: (Readable.toWeb(createReadStream(servedPath, { start, end })) as ReadableStream);
595+
: // Node's web stream type and the DOM one do not overlap for tsc on
596+
// every platform's lib set; the double cast is the documented bridge.
597+
(Readable.toWeb(
598+
createReadStream(servedPath, { start, end }),
599+
) as unknown as ReadableStream);
596600

597601
// Support byte-range requests so browsers can seek audio/video elements.
598602
const rangeHeader = c.req.header("Range");

0 commit comments

Comments
 (0)