Skip to content

Enable verbatimModuleSyntax for http-client and http-client-js - #11484

Open
timotheeguerin wants to merge 5 commits into
microsoft:mainfrom
timotheeguerin:type-import-pass-4
Open

Enable verbatimModuleSyntax for http-client and http-client-js#11484
timotheeguerin wants to merge 5 commits into
microsoft:mainfrom
timotheeguerin:type-import-pass-4

Conversation

@timotheeguerin

Copy link
Copy Markdown
Member

Part of an incremental rollout of TypeScript's verbatimModuleSyntax across the monorepo, one batch of packages per PR (ordered easiest → hardest). This is batch 4.

Packages migrated

  • @typespec/http-client (84 type-only imports)
  • @typespec/http-client-js (112 type-only imports)

What changed

  • Added "verbatimModuleSyntax": true to each package's tsconfig.json.
  • Converted type-only imports/exports to import type / export type using oxlint's type-aware consistent-type-imports / consistent-type-exports autofix.

Using the type-aware autofix (rather than a manual TS1484-driven pass) also correctly handles class imports used only in type positions — classes are both a type and a value, so verbatimModuleSyntax does not flag them, yet leaving them as runtime imports changes emit.

Validation

  • tsc reports 0 verbatimModuleSyntax errors for both packages.
  • alloy build succeeds for both packages.
  • prettier and oxlint (--type-aware --deny-warnings) clean.

Standalone runtime emitters (http-client-csharp, http-client-java, http-client-python) remain out of scope.

Add "verbatimModuleSyntax": true to both packages' tsconfig and convert
type-only imports to import type via oxlint type-aware autofix.
@microsoft-github-policy-service microsoft-github-policy-service Bot added the emitter:client:js Issue for the JS client emitter: @typespec/http-client-js label Jul 30, 2026
@pkg-pr-new

pkg-pr-new Bot commented Jul 30, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/microsoft/typespec/@typespec/http-client@11484
npm i https://pkg.pr.new/microsoft/typespec/@typespec/http-client-js@11484

commit: 1e31314

@github-actions

Copy link
Copy Markdown
Contributor

All changed packages have been documented.

  • @typespec/http-client-js
  • @typespec/http-client
Show changes

@typespec/http-client - internal ✏️

Enable verbatimModuleSyntax and convert type-only imports to import type.

@typespec/http-client-js - internal ✏️

Enable verbatimModuleSyntax and convert type-only imports to import type.

@azure-sdk-automation

azure-sdk-automation Bot commented Jul 30, 2026

Copy link
Copy Markdown

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

oxlint's consistent-type-exports converted `export * from ./operation.js`
(and model / model-property) to `export type *`. Those kit modules only
export types but run `defineKit(...)` at import time to register typekit
methods; `export type *` drops the module so registration never happens,
causing `$.operation.getClientSignature is not a function` at emit time.
…d fixtures

tsconfig.test.json extends the package tsconfig (now verbatimModuleSyntax:
true) and compiles the emitter's generated e2e client code under
test/e2e/generated, which uses plain `import { X }` for type-only imports.
That is emitter output, not authored source, so override
verbatimModuleSyntax to false for the e2e test build.
@timotheeguerin
timotheeguerin enabled auto-merge July 30, 2026 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:client:js Issue for the JS client emitter: @typespec/http-client-js

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant