ITADN

[Bug]: typespec-ts: multipartHelpers.ts and get-binary-stream-response.ts compilation error in non-standard generation output path

#4581Openjeremymeng 创建于 2026-06-08
bugemitter:typescript
J
jeremymengcommented
### Describe the bug my generation output is `src/generated` because of existing storage-blob package. After code generation with typespec-ts 0.54.0 the two files comtain compilation errors. Likely due to them being static files and their hard-coded `import { NodeReadableStream } from "#platform/static-helpers/platform-types";` <img width="933" height="84" alt="Image" src="https://github.com/user-attachments/assets/bec9b67e-30bc-4c1c-b3cb-392aead627cb" />. In my package.json, `"#platform"` is mapped to `src/` The correct path is included in the generated `index.ts`: <img width="1072" height="108" alt="Image" src="https://github.com/user-attachments/assets/6af9c9f4-549a-4e25-859f-4a4e6b362d0f" /> 1) I noticed that src\generated\static-helpers\serialization\get-binary-stream-response-browser.mts doesn't use `#platform` import: `import { NodeReadableStream } from "../platform-types-browser.mjs";` For static files I guess it probably should work if we just import directory from the file, i.e., src\generated\static-helpers\serialization\get-binary-stream-response.ts version would have `import { NodeReadableStream } from "../platform-types.js";`. 2) src\generated\static-helpers\multipartHelpers.ts needs proper `#platform` imports though. It probably will need to be dynamic as the path in `"#platform/static-helpers/platform-types";` could vary ### Reproduction run `tsp-client update` under `sdk/storage/storage-blob` using the https://github.com/Azure/azure-sdk-for-js/tree/storage/blob-typespec-based branch ### Checklist - [x] Follow our [Code of Conduct](https://github.com/azure/typespec-azure/blob/main/CODE_OF_CONDUCT.md) - [x] Check that this issue is about the Azure libraries for typespec. For bug in the typespec language or core libraries file it in the [TypeSpec repo](https://github.com/Microsoft/TypeSpec/issues/new/choose) - [x] Check that there isn't already an issue that request the same bug to avoid creating a duplicate. - [x] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.
1 条评论