fix: replace NodeJS.ReadableStream with platform-conditional NodeReadableStream in RLC generated code#3998
Draft
Copilot wants to merge 2 commits into
Draft
fix: replace NodeJS.ReadableStream with platform-conditional NodeReadableStream in RLC generated code#3998Copilot wants to merge 2 commits into
Copilot wants to merge 2 commits into
Conversation
…form/ import in RLC generated code Replace inline NodeJS.ReadableStream type references with NodeReadableStream imported from platform-types static helper. This uses the #platform/ subpath import pattern (for azureSdkForJs) so that browser builds resolve to `never` and Node builds resolve to the actual NodeJS.ReadableStream type. Agent-Logs-Url: https://github.com/Azure/autorest.typescript/sessions/197375da-5572-4d2b-9001-6e387e9f043d Co-authored-by: jeremymeng <7583839+jeremymeng@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix RLC emitter bytes request body for browser builds
fix: replace NodeJS.ReadableStream with platform-conditional NodeReadableStream in RLC generated code
May 22, 2026
jeremymeng
reviewed
May 22, 2026
| // Add NodeReadableStream import if binary types are used in models | ||
| if (modelsFile.getFullText().includes("NodeReadableStream")) { | ||
| const platformTypesModuleSpecifier = model.options?.azureSdkForJs | ||
| ? "#platform/static-helpers/platform-types.js" |
Member
There was a problem hiding this comment.
Suggested change
| ? "#platform/static-helpers/platform-types.js" | |
| ? "#platform/static-helpers/platform-types" |
|
Hi Team, Just checking in. No rush I just wanted to know when is the expected merge/deployment date for this change since we have an API committee review coming up on Tuesday. Would be helpful to have an ETA. Thank you CC: @qiaozha @kazrael2119 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RLC emitter generates
NodeJS.ReadableStreaminline in binary request body type unions, which breaks browser builds that exclude@types/node(TS2503). This affects any data-plane service withbytesrequest bodies.Changes
packages/typespec-ts/src/utils/modelUtils.ts— ReplaceNodeJS.ReadableStreamwithNodeReadableStreaminBINARY_TYPE_UNIONpackages/rlc-common/src/buildParameterTypes.ts— Emitimport type { NodeReadableStream }from platform-types when binary types are present in generated parameterspackages/rlc-common/src/buildSchemaType.ts— Same import logic for generated model filespackages/rlc-common/src/buildObjectTypes.ts— UpdateisBinaryArray()detection to match new type nameFor
azureSdkForJspackages the import uses#platform/static-helpers/platform-types.js(subpath import), otherwise a relative path. The existing platform-types static helper resolves toNodeJS.ReadableStreamon Node andneveron browser, so the union arm drops out naturally in browser builds.