Skip to content

RLC: Remove NodeJS.ReadableStream from bytes request-body unions for browser-safe typings#3992

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-browser-build-issue
Draft

RLC: Remove NodeJS.ReadableStream from bytes request-body unions for browser-safe typings#3992
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-browser-build-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 21, 2026

RLC currently emits NodeJS.ReadableStream in bytes request-body parameter unions, which breaks browser builds when @types/node is intentionally excluded (types: []). This change makes the emitted binary input type portable across browser and Node targets.

  • Emitter typing update (RLC binary inputs)

    • Updated the shared binary request-body union in packages/typespec-ts/src/utils/modelUtils.ts:
      • from ... | NodeJS.ReadableStream
      • to ... | AsyncIterable<Uint8Array>
    • This preserves stream-based input support without requiring the NodeJS namespace in generated parameters.ts.
  • Unit expectation updates

    • Updated RLC bytes generator assertions in packages/typespec-ts/test/unit/bytesGenerator.spec.ts to match the new emitted type.
    • Kept coverage focused on bytes request bodies and multipart bytes-related unions.
  • Representative emitted type change

    // before
    body: string | Uint8Array | ReadableStream<Uint8Array> | NodeJS.ReadableStream;
    
    // after
    body: string | Uint8Array | ReadableStream<Uint8Array> | AsyncIterable<Uint8Array>;

Agent-Logs-Url: https://github.com/Azure/autorest.typescript/sessions/2adb414c-3c36-49bb-9665-00c57e6b3390

Co-authored-by: siddharth9606 <199754214+siddharth9606@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix browser build failure due to NodeJS.ReadableStream union RLC: Remove NodeJS.ReadableStream from bytes request-body unions for browser-safe typings May 21, 2026
Copilot AI requested a review from siddharth9606 May 21, 2026 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RLC: bytes request body emits NodeJS.ReadableStream union arm, breaking browser build (TS2503)

2 participants