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.
This commit is contained in:
Miguel Ángel
2026-09-07 10:57:58 -04:00
committed by GitHub
parent 8825def610
commit 8958342dd1
+5 -1
View File
@@ -592,7 +592,11 @@ export function registerPreviewRoutes(api: Hono, adapter: PreviewApiAdapter): vo
const bodyFor = (start: number, end: number): BodyInit =>
textBuffer
? new Uint8Array(textBuffer.subarray(start, end + 1))
: (Readable.toWeb(createReadStream(servedPath, { start, end })) as ReadableStream);
: // Node's web stream type and the DOM one do not overlap for tsc on
// every platform's lib set; the double cast is the documented bridge.
(Readable.toWeb(
createReadStream(servedPath, { start, end }),
) as unknown as ReadableStream);
// Support byte-range requests so browsers can seek audio/video elements.
const rangeHeader = c.req.header("Range");