Skip to content

[typespec-ts] fix platform import issue for customization#4585

Open
kazrael2119 wants to merge 25 commits into
Azure:mainfrom
kazrael2119:fix-platfor-import
Open

[typespec-ts] fix platform import issue for customization#4585
kazrael2119 wants to merge 25 commits into
Azure:mainfrom
kazrael2119:fix-platfor-import

Conversation

@kazrael2119

Copy link
Copy Markdown
Member

fixes #4581

@microsoft-github-policy-service microsoft-github-policy-service Bot added the emitter:typescript Issues for @azure-tools/typespec-ts emitter label Jun 9, 2026
@azure-sdk

azure-sdk commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

All changed packages have been documented.

  • @azure-tools/typespec-ts
Show changes

@azure-tools/typespec-ts - fix ✏️

[typespec-ts] fix platform import issue for customization

@pkg-pr-new

pkg-pr-new Bot commented Jun 9, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@azure-tools/typespec-ts@4585

commit: e5674c5

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

⚡ Benchmark Results

⚠️ 2 metric(s) regressed above the +5% threshold:

Metric Baseline Current Change
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes 🟢 5.4ms 🟡 12.6ms +130.9% 🔴
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-post-operation-response-codes 🟢 1.4ms 🟢 3.3ms +140.4% 🔴
Full details – comparing bbcc784 vs baseline rolling-baseline-aac448e-4df8556 (rolling baseline (20 main runs))
Metric Baseline Current Change
total 🔴 997.8ms 🔴 865.7ms -13.2% 🟢
loader 🟡 300.5ms 🟡 261.5ms -13.0% 🟢
resolver 🟢 39.9ms 🟢 36.1ms -9.6% 🟢
checker 🟡 359.7ms 🟡 308.1ms -14.4% 🟢
validation 🟢 84.9ms 🟢 74.5ms -12.3% 🟢
 ↳ validation/@azure-tools/typespec-azure-core 🟡 12.4ms 🟡 10.5ms -15.5% 🟢
 ↳ validation/@typespec/http 🟡 15.3ms 🟡 13.4ms -12.5% 🟢
 ↳ validation/@typespec/rest 🟢 1.6ms 🟢 1.5ms -6.6%
 ↳ validation/@typespec/versioning 🔴 51.5ms 🔴 45.6ms -11.5% 🟢
 ↳ validation/compiler 🟢 3.8ms 🟢 3.5ms -10.2%
linter 🟡 212.1ms 🟢 185.3ms -12.6% 🟢
 ↳ linter/@azure-tools/typespec-azure-core/auth-required 🟢 0.1ms 🟢 0.1ms -17.9%
 ↳ linter/@azure-tools/typespec-azure-core/bad-record-type 🟢 0.6ms 🟢 0.6ms -7.7%
 ↳ linter/@azure-tools/typespec-azure-core/byos 🟢 8.2ms 🟢 7.5ms -9.5%
 ↳ linter/@azure-tools/typespec-azure-core/casing-style 🟢 1.4ms 🟢 1.4ms -3.8%
 ↳ linter/@azure-tools/typespec-azure-core/composition-over-inheritance 🟢 0.2ms 🟢 0.2ms -13.3%
 ↳ linter/@azure-tools/typespec-azure-core/documentation-required 🟢 1.9ms 🟢 1.7ms -10.2%
 ↳ linter/@azure-tools/typespec-azure-core/friendly-name 🟢 1.4ms 🟢 1.3ms -7.7%
 ↳ linter/@azure-tools/typespec-azure-core/key-visibility-required 🟢 0.4ms 🟢 0.3ms -12.5%
 ↳ linter/@azure-tools/typespec-azure-core/known-encoding 🟢 0.5ms 🟢 0.4ms -10.4%
 ↳ linter/@azure-tools/typespec-azure-core/long-running-polling-operation-required 🟢 0.8ms 🟢 0.8ms +0.1%
 ↳ linter/@azure-tools/typespec-azure-core/no-case-mismatch 🟢 0.7ms 🟢 0.6ms -10.7%
 ↳ linter/@azure-tools/typespec-azure-core/no-closed-literal-union 🟢 1.0ms 🟢 0.9ms -5.6%
 ↳ linter/@azure-tools/typespec-azure-core/no-enum 🟢 0.2ms 🟢 0.2ms -7.9%
 ↳ linter/@azure-tools/typespec-azure-core/no-error-status-codes 🟢 0.3ms 🟢 0.3ms -0.0%
 ↳ linter/@azure-tools/typespec-azure-core/no-explicit-routes-resource-ops 🟢 0.2ms 🟢 0.2ms -1.5%
 ↳ linter/@azure-tools/typespec-azure-core/no-format 🟢 0.8ms 🟢 0.8ms -2.2%
 ↳ linter/@azure-tools/typespec-azure-core/no-generic-numeric 🟢 0.8ms 🟢 0.7ms -13.7%
 ↳ linter/@azure-tools/typespec-azure-core/no-header-explode 🔴 26.1ms 🔴 21.8ms -16.7% 🟢
 ↳ linter/@azure-tools/typespec-azure-core/no-legacy-usage 🟢 2.0ms 🟢 1.9ms -4.3%
 ↳ linter/@azure-tools/typespec-azure-core/no-multiple-discriminator 🟢 0.2ms 🟢 0.2ms -16.9%
 ↳ linter/@azure-tools/typespec-azure-core/no-nullable 🟢 0.4ms 🟢 0.4ms -13.1%
 ↳ linter/@azure-tools/typespec-azure-core/no-offsetdatetime 🟢 1.9ms 🟢 1.7ms -14.2%
 ↳ linter/@azure-tools/typespec-azure-core/no-openapi 🟢 2.3ms 🟢 2.1ms -6.8%
 ↳ linter/@azure-tools/typespec-azure-core/no-private-usage 🟢 3.1ms 🟢 2.9ms -5.1%
 ↳ linter/@azure-tools/typespec-azure-core/no-query-explode 🔴 27.3ms 🔴 22.9ms -15.9% 🟢
 ↳ linter/@azure-tools/typespec-azure-core/no-response-body 🔴 32.8ms 🔴 28.5ms -13.0% 🟢
 ↳ linter/@azure-tools/typespec-azure-core/no-rest-library-interfaces 🟢 0.1ms 🟢 0.1ms -10.7%
 ↳ linter/@azure-tools/typespec-azure-core/no-route-parameter-name-mismatch 🟢 7.5ms 🟢 6.4ms -15.1% 🟢
 ↳ linter/@azure-tools/typespec-azure-core/no-rpc-path-params 🟢 0.4ms 🟢 0.3ms -13.7%
 ↳ linter/@azure-tools/typespec-azure-core/no-string-discriminator 🟢 0.1ms 🟢 0.1ms -17.7%
 ↳ linter/@azure-tools/typespec-azure-core/no-unknown 🟢 0.3ms 🟢 0.3ms -10.4%
 ↳ linter/@azure-tools/typespec-azure-core/no-unnamed-union 🟢 0.8ms 🟢 0.7ms -6.2%
 ↳ linter/@azure-tools/typespec-azure-core/operation-missing-api-version 🟢 0.4ms 🟢 0.4ms +5.4%
 ↳ linter/@azure-tools/typespec-azure-core/request-body-problem 🟢 0.5ms 🟢 0.4ms -6.2%
 ↳ linter/@azure-tools/typespec-azure-core/require-versioned 🟢 0.1ms 🟢 0.1ms -14.2%
 ↳ linter/@azure-tools/typespec-azure-core/response-schema-problem 🔴 32.2ms 🔴 28.1ms -12.6% 🟢
 ↳ linter/@azure-tools/typespec-azure-core/rpc-operation-request-body 🟢 0.7ms 🟢 0.6ms -11.8%
 ↳ linter/@azure-tools/typespec-azure-core/spread-discriminated-model 🟢 0.5ms 🟢 0.4ms -8.7%
 ↳ linter/@azure-tools/typespec-azure-core/use-standard-names 🟢 7.4ms 🟢 6.3ms -14.8% 🟢
 ↳ linter/@azure-tools/typespec-azure-core/use-standard-operations 🟢 0.3ms 🟢 0.2ms -7.3%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-agent-base-type-child-resources 🔴 21.6ms 🟡 10.9ms -49.6% 🟢
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-agent-base-type-lifecycle-operations 🟢 0.3ms 🟢 0.2ms -22.3%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-common-types-version 🟡 12.0ms 🟢 9.8ms -18.9% 🟢
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-custom-resource-no-key 🟢 0.2ms 🟢 0.2ms -15.3%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-custom-resource-usage-discourage 🟢 0.1ms 🟢 0.1ms -14.0%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes 🟢 5.4ms 🟡 12.6ms +130.9% 🔴
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-no-path-casing-conflicts 🟡 17.0ms 🟡 14.2ms -16.4% 🟢
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-no-record 🟢 0.6ms 🟢 0.6ms -7.1%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-post-operation-response-codes 🟢 1.4ms 🟢 3.3ms +140.4% 🔴
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-put-operation-response-codes 🟢 0.2ms 🟢 0.3ms +16.5%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-action-no-segment 🟢 0.4ms 🟢 0.5ms +4.2%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-duplicate-property 🟢 0.4ms 🟢 0.3ms -12.0%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-interface-requires-decorator 🟢 0.1ms 🟢 0.1ms -15.3%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-action-verb 🟢 0.2ms 🟢 0.2ms +0.4%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property 🟢 0.3ms 🟢 0.2ms -12.6%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-version-format 🟢 0.2ms 🟢 0.2ms +1.3%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-key-invalid-chars 🟢 0.5ms 🟢 0.4ms -13.5%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-name-pattern 🟢 0.1ms 🟢 0.2ms +10.8%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-operation 🟢 0.5ms 🟢 0.5ms +2.7%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-operation-response 🟢 8.8ms 🟢 7.9ms -10.2%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-patch 🟢 0.8ms 🟢 0.8ms -8.6%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-path-segment-invalid-chars 🟢 0.4ms 🟢 0.3ms -11.5%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/arm-resource-provisioning-state 🟢 0.4ms 🟢 0.4ms -4.8%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/beyond-nesting-levels 🟢 0.2ms 🟢 0.2ms -13.7%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/empty-updateable-properties 🟢 0.4ms 🟢 0.3ms -15.4%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/improper-subscription-list-operation 🟢 0.1ms 🟢 0.1ms -10.2%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/lro-location-header 🟡 19.2ms 🟡 16.3ms -15.0% 🟢
 ↳ linter/@azure-tools/typespec-azure-resource-manager/missing-operations-endpoint 🟢 0.1ms 🟢 0.1ms -4.7%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers 🟢 1.0ms 🟢 0.9ms -8.0%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/no-empty-model 🟢 0.3ms 🟢 0.2ms -18.0%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/no-override-props 🟢 0.3ms 🟢 0.3ms -2.2%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/no-resource-delete-operation 🟢 0.4ms 🟢 0.4ms -17.6%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/no-response-body 🔴 29.3ms 🔴 24.9ms -14.9% 🟢
 ↳ linter/@azure-tools/typespec-azure-resource-manager/patch-envelope 🟢 0.4ms 🟢 0.4ms -11.0%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/resource-name 🟢 0.4ms 🟢 0.4ms -10.7%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/secret-prop 🟢 5.4ms 🟢 4.7ms -13.1%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/unsupported-type 🟢 0.7ms 🟢 0.6ms -9.2%
 ↳ linter/@azure-tools/typespec-azure-resource-manager/version-progression 🟢 0.3ms 🟢 0.3ms +3.9%
 ↳ linter/@azure-tools/typespec-client-generator-core/property-name-conflict 🟢 2.3ms 🟢 2.1ms -6.2%
 ↳ linter/@azure-tools/typespec-client-generator-core/require-client-suffix 🟢 1.6ms 🟢 1.6ms -2.7%
emit 🔴 5.97s 🔴 5.12s -14.2% 🟢
 ↳ emit/@Azure-Tools 🟢 0.0ms 🟢 0.0ms +0.0%
 ↳ emit/@azure-tools/typespec-autorest 🟢 123.8ms 🟢 109.9ms -11.2% 🟢
 ↳ emit/@azure-tools/typespec-python 🔴 2.23s 🔴 1.89s -15.0% 🟢
 ↳ emit/@typespec 🟢 0.0ms 🟢 0.0ms +0.0%
 ↳ emit/@typespec/http-client-js 🔴 564.7ms 🔴 497.3ms -11.9% 🟢
 ↳ emit/@typespec/openapi3 🟢 106.3ms 🟢 91.9ms -13.6% 🟢
 ↳ emit/@typespec/openapi3/compute 🟢 92.3ms 🟢 79.7ms -13.6% 🟢
 ↳ emit/@typespec/openapi3/write 🟢 13.8ms 🟢 11.9ms -13.7% 🟢

Averaged across 3 specs (azure-arm-resource-manager, azure-core-dataplane, azure-full).
Threshold: changes > ±5% are highlighted.
🟢 Fast · 🟡 Moderate (stages >200ms, rules >10ms) · 🔴 Slow (stages >400ms, rules >20ms)

@azure-sdk

Copy link
Copy Markdown
Collaborator

You can try these changes here

🛝 Playground 🌐 Website

@jeremymeng

Copy link
Copy Markdown
Member

@kazrael2119 maybe as part of this PR, we could get rid of the platform-types source files, and import from @azure/core-rest-pipeline? The type is available now in latest v1.24.0 https://github.com/Azure/azure-sdk-for-js/blob/%40azure/core-rest-pipeline_1.24.0/sdk/core/core-rest-pipeline/review/core-rest-pipeline-node.api.md?plain=1#L239

@JialinHuang803

Copy link
Copy Markdown
Member

Maybe we can remove #platform in this PR after Azure/azure-sdk-for-js#38909.

Comment thread packages/typespec-ts/src/modular/static-helpers-metadata.ts Outdated
Comment thread packages/typespec-ts/src/modular/static-helpers-metadata.ts Outdated
Comment thread packages/typespec-ts/src/rlc-common/metadata/build-package-file.ts Outdated
@kazrael2119 kazrael2119 requested a review from xirzec as a code owner June 29, 2026 08:42
Copilot AI added a commit that referenced this pull request Jul 3, 2026
…expectations

Co-authored-by: kazrael2119 <98569699+kazrael2119@users.noreply.github.com>
Comment thread packages/typespec-ts/src/metadata/build-package-file.ts Outdated
Comment thread packages/typespec-ts/test-next/unit/metadata/package-json.test.ts
});
expect(packageFile.dependencies).to.have.property("@azure-rest/core-client", "^2.7.0");
expect(packageFile.dependencies).to.have.property("@azure/core-rest-pipeline", "^1.24.0");
expect(packageFile.dependencies).to.have.property("tslib", "^2.8.1");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember that tslib is already changed to be imported from catalog. Should we change this as well?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread packages/typespec-ts/test-next/unit/metadata/package-json.test.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:typescript Issues for @azure-tools/typespec-ts emitter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

4 participants