Skip to content

Enable verbatimModuleSyntax in typespec-ts - #5134

Merged
Jeff Fisher (xirzec) merged 1 commit into
Azure:mainfrom
timotheeguerin:vms/typespec-ts
Aug 3, 2026
Merged

Enable verbatimModuleSyntax in typespec-ts#5134
Jeff Fisher (xirzec) merged 1 commit into
Azure:mainfrom
timotheeguerin:vms/typespec-ts

Conversation

@timotheeguerin

@timotheeguerin Timothee Guerin (timotheeguerin) commented Jul 31, 2026

Copy link
Copy Markdown
Member

Type-only imports in typespec-azure are still emitted as runtime imports. That leaves dead runtime edges in the emitted JS, makes module side effects ambiguous, and blocks ever turning verbatimModuleSyntax on repo-wide — something core has already been rolling out package by package.

This enables the flag for typespec-ts and rewrites the imports it flags:

-import { SdkContext } from "./interfaces.js";
+import type { SdkContext } from "./interfaces.js";

The rewrite was driven by the compiler rather than by regex: build the program with the flag on, collect the TS1484/TS1485/TS1205 diagnostics, and change exactly the specifiers TypeScript names — hoisting to import type when every specifier in a clause is type-only, otherwise adding an inline type modifier. tsc then reports zero new errors against a pre-change baseline, so no value binding was turned into a type-only one.

One of a series of PRs, one per package, so each diff stays reviewable. They are independent and can land in any order.

static/ is deliberately untouched: those helpers are copied verbatim into generated SDKs, so migrating them changes emitted output and needs baseline regeneration. tsconfig.test.json, the only project that pulls them in, opts out explicitly.

PR Scope
#5127 samples, typespec-python, benchmark, typespec-azure-playground-website, typespec-metadata, spector-runner
#5128 azure-http-specs
#5129 typespec-autorest
#5130 typespec-azure-core
#5131 typespec-azure-resource-manager
#5132 typespec-client-generator-core
#5133 typespec-go
#5134 typespec-ts
#5135 eng/ scripts

typespec-autorest-canonical, typespec-azure-portal-core and typespec-azure-rulesets already had the flag. typespec-java is deliberately left out: its src/ is copied in at build time from azure-sdk-for-java, so the flag would break its build until those sources are migrated upstream.

Once these land, a follow-up will hoist the flag into a repo-level tsconfig.base.json and drop the per-package copies, so new packages inherit it by default.

@github-actions

Copy link
Copy Markdown
Contributor

All changed packages have been documented.

  • @azure-tools/typespec-ts
Show changes

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

Enable verbatimModuleSyntax and use import type for type-only imports. No runtime or public API changes.

@pkg-pr-new

pkg-pr-new Bot commented Jul 31, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: fb8c71d

@azure-sdk-automation

Copy link
Copy Markdown
Contributor

You can try these changes here

🛝 Playground 🌐 Website

Chidozie Ononiwu (chidozieononiwu) pushed a commit to chidozieononiwu/typespec-azure that referenced this pull request Aug 1, 2026
…5132)

Type-only imports in `typespec-azure` are still emitted as runtime
imports. That leaves dead runtime edges in the emitted JS, makes module
side effects ambiguous, and blocks ever turning `verbatimModuleSyntax`
on repo-wide — something `core` has already been rolling out package by
package.

This enables the flag for **`typespec-client-generator-core`** and
rewrites the imports it flags:

```diff
-import { SdkContext } from "./interfaces.js";
+import type { SdkContext } from "./interfaces.js";
```

The rewrite was driven by the compiler rather than by regex: build the
program with the flag on, collect the TS1484/TS1485/TS1205 diagnostics,
and change exactly the specifiers TypeScript names — hoisting to `import
type` when every specifier in a clause is type-only, otherwise adding an
inline `type` modifier. `tsc` then reports zero new errors against a
pre-change baseline, so no value binding was turned into a type-only
one.

One of a series of PRs, one per package, so each diff stays reviewable.
They are independent and can land in any order.

| PR | Scope |
| --- | --- |
| Azure#5127 | `samples`, `typespec-python`, `benchmark`,
`typespec-azure-playground-website`, `typespec-metadata`,
`spector-runner` |
| Azure#5128 | `azure-http-specs` |
| Azure#5129 | `typespec-autorest` |
| Azure#5130 | `typespec-azure-core` |
| Azure#5131 | `typespec-azure-resource-manager` |
| Azure#5132 | `typespec-client-generator-core` |
| Azure#5133 | `typespec-go` |
| Azure#5134 | `typespec-ts` |
| Azure#5135 | `eng/` scripts |

`typespec-autorest-canonical`, `typespec-azure-portal-core` and
`typespec-azure-rulesets` already had the flag. `typespec-java` is
deliberately left out: its `src/` is copied in at build time from
`azure-sdk-for-java`, so the flag would break its build until those
sources are migrated upstream.

Once these land, a follow-up will hoist the flag into a repo-level
`tsconfig.base.json` and drop the per-package copies, so new packages
inherit it by default.
Chidozie Ononiwu (chidozieononiwu) pushed a commit to chidozieononiwu/typespec-azure that referenced this pull request Aug 1, 2026
Type-only imports in `typespec-azure` are still emitted as runtime
imports. That leaves dead runtime edges in the emitted JS, makes module
side effects ambiguous, and blocks ever turning `verbatimModuleSyntax`
on repo-wide — something `core` has already been rolling out package by
package.

This enables the flag for **the `eng/` scripts (`tsconfig.eng.json`)**
and rewrites the imports it flags:

```diff
-import { SdkContext } from "./interfaces.js";
+import type { SdkContext } from "./interfaces.js";
```

The rewrite was driven by the compiler rather than by regex: build the
program with the flag on, collect the TS1484/TS1485/TS1205 diagnostics,
and change exactly the specifiers TypeScript names — hoisting to `import
type` when every specifier in a clause is type-only, otherwise adding an
inline `type` modifier. `tsc` then reports zero new errors against a
pre-change baseline, so no value binding was turned into a type-only
one.

One of a series of PRs, one per package, so each diff stays reviewable.
They are independent and can land in any order.

| PR | Scope |
| --- | --- |
| Azure#5127 | `samples`, `typespec-python`, `benchmark`,
`typespec-azure-playground-website`, `typespec-metadata`,
`spector-runner` |
| Azure#5128 | `azure-http-specs` |
| Azure#5129 | `typespec-autorest` |
| Azure#5130 | `typespec-azure-core` |
| Azure#5131 | `typespec-azure-resource-manager` |
| Azure#5132 | `typespec-client-generator-core` |
| Azure#5133 | `typespec-go` |
| Azure#5134 | `typespec-ts` |
| Azure#5135 | `eng/` scripts |

`typespec-autorest-canonical`, `typespec-azure-portal-core` and
`typespec-azure-rulesets` already had the flag. `typespec-java` is
deliberately left out: its `src/` is copied in at build time from
`azure-sdk-for-java`, so the flag would break its build until those
sources are migrated upstream.

Once these land, a follow-up will hoist the flag into a repo-level
`tsconfig.base.json` and drop the per-package copies, so new packages
inherit it by default.
Chidozie Ononiwu (chidozieononiwu) pushed a commit to chidozieononiwu/typespec-azure that referenced this pull request Aug 1, 2026
…#5131)

Type-only imports in `typespec-azure` are still emitted as runtime
imports. That leaves dead runtime edges in the emitted JS, makes module
side effects ambiguous, and blocks ever turning `verbatimModuleSyntax`
on repo-wide — something `core` has already been rolling out package by
package.

This enables the flag for **`typespec-azure-resource-manager`** and
rewrites the imports it flags:

```diff
-import { SdkContext } from "./interfaces.js";
+import type { SdkContext } from "./interfaces.js";
```

The rewrite was driven by the compiler rather than by regex: build the
program with the flag on, collect the TS1484/TS1485/TS1205 diagnostics,
and change exactly the specifiers TypeScript names — hoisting to `import
type` when every specifier in a clause is type-only, otherwise adding an
inline `type` modifier. `tsc` then reports zero new errors against a
pre-change baseline, so no value binding was turned into a type-only
one.

One of a series of PRs, one per package, so each diff stays reviewable.
They are independent and can land in any order.

| PR | Scope |
| --- | --- |
| Azure#5127 | `samples`, `typespec-python`, `benchmark`,
`typespec-azure-playground-website`, `typespec-metadata`,
`spector-runner` |
| Azure#5128 | `azure-http-specs` |
| Azure#5129 | `typespec-autorest` |
| Azure#5130 | `typespec-azure-core` |
| Azure#5131 | `typespec-azure-resource-manager` |
| Azure#5132 | `typespec-client-generator-core` |
| Azure#5133 | `typespec-go` |
| Azure#5134 | `typespec-ts` |
| Azure#5135 | `eng/` scripts |

`typespec-autorest-canonical`, `typespec-azure-portal-core` and
`typespec-azure-rulesets` already had the flag. `typespec-java` is
deliberately left out: its `src/` is copied in at build time from
`azure-sdk-for-java`, so the flag would break its build until those
sources are migrated upstream.

Once these land, a follow-up will hoist the flag into a repo-level
`tsconfig.base.json` and drop the per-package copies, so new packages
inherit it by default.
Chidozie Ononiwu (chidozieononiwu) pushed a commit to chidozieononiwu/typespec-azure that referenced this pull request Aug 1, 2026
Type-only imports in `typespec-azure` are still emitted as runtime
imports. That leaves dead runtime edges in the emitted JS, makes module
side effects ambiguous, and blocks ever turning `verbatimModuleSyntax`
on repo-wide — something `core` has already been rolling out package by
package.

This enables the flag for **`typespec-autorest`** and rewrites the
imports it flags:

```diff
-import { SdkContext } from "./interfaces.js";
+import type { SdkContext } from "./interfaces.js";
```

The rewrite was driven by the compiler rather than by regex: build the
program with the flag on, collect the TS1484/TS1485/TS1205 diagnostics,
and change exactly the specifiers TypeScript names — hoisting to `import
type` when every specifier in a clause is type-only, otherwise adding an
inline `type` modifier. `tsc` then reports zero new errors against a
pre-change baseline, so no value binding was turned into a type-only
one.

One of a series of PRs, one per package, so each diff stays reviewable.
They are independent and can land in any order.

| PR | Scope |
| --- | --- |
| Azure#5127 | `samples`, `typespec-python`, `benchmark`,
`typespec-azure-playground-website`, `typespec-metadata`,
`spector-runner` |
| Azure#5128 | `azure-http-specs` |
| Azure#5129 | `typespec-autorest` |
| Azure#5130 | `typespec-azure-core` |
| Azure#5131 | `typespec-azure-resource-manager` |
| Azure#5132 | `typespec-client-generator-core` |
| Azure#5133 | `typespec-go` |
| Azure#5134 | `typespec-ts` |
| Azure#5135 | `eng/` scripts |

`typespec-autorest-canonical`, `typespec-azure-portal-core` and
`typespec-azure-rulesets` already had the flag. `typespec-java` is
deliberately left out: its `src/` is copied in at build time from
`azure-sdk-for-java`, so the flag would break its build until those
sources are migrated upstream.

Once these land, a follow-up will hoist the flag into a repo-level
`tsconfig.base.json` and drop the per-package copies, so new packages
inherit it by default.
Chidozie Ononiwu (chidozieononiwu) pushed a commit to chidozieononiwu/typespec-azure that referenced this pull request Aug 1, 2026
Type-only imports in `typespec-azure` are still emitted as runtime
imports. That leaves dead runtime edges in the emitted JS, makes module
side effects ambiguous, and blocks ever turning `verbatimModuleSyntax`
on repo-wide — something `core` has already been rolling out package by
package.

This enables the flag for **`samples`, `typespec-python`, `benchmark`,
`typespec-azure-playground-website`, `typespec-metadata` and
`spector-runner`** and rewrites the imports it flags:

```diff
-import { SdkContext } from "./interfaces.js";
+import type { SdkContext } from "./interfaces.js";
```

The rewrite was driven by the compiler rather than by regex: build the
program with the flag on, collect the TS1484/TS1485/TS1205 diagnostics,
and change exactly the specifiers TypeScript names — hoisting to `import
type` when every specifier in a clause is type-only, otherwise adding an
inline `type` modifier. `tsc` then reports zero new errors against a
pre-change baseline, so no value binding was turned into a type-only
one.

One of a series of PRs, one per package, so each diff stays reviewable.
They are independent and can land in any order.

| PR | Scope |
| --- | --- |
| Azure#5127 | `samples`, `typespec-python`, `benchmark`,
`typespec-azure-playground-website`, `typespec-metadata`,
`spector-runner` |
| Azure#5128 | `azure-http-specs` |
| Azure#5129 | `typespec-autorest` |
| Azure#5130 | `typespec-azure-core` |
| Azure#5131 | `typespec-azure-resource-manager` |
| Azure#5132 | `typespec-client-generator-core` |
| Azure#5133 | `typespec-go` |
| Azure#5134 | `typespec-ts` |
| Azure#5135 | `eng/` scripts |

`typespec-autorest-canonical`, `typespec-azure-portal-core` and
`typespec-azure-rulesets` already had the flag. `typespec-java` is
deliberately left out: its `src/` is copied in at build time from
`azure-sdk-for-java`, so the flag would break its build until those
sources are migrated upstream.

Once these land, a follow-up will hoist the flag into a repo-level
`tsconfig.base.json` and drop the per-package copies, so new packages
inherit it by default.
Chidozie Ononiwu (chidozieononiwu) pushed a commit to chidozieononiwu/typespec-azure that referenced this pull request Aug 1, 2026
Type-only imports in `typespec-azure` are still emitted as runtime
imports. That leaves dead runtime edges in the emitted JS, makes module
side effects ambiguous, and blocks ever turning `verbatimModuleSyntax`
on repo-wide — something `core` has already been rolling out package by
package.

This enables the flag for **`typespec-azure-core`** and rewrites the
imports it flags:

```diff
-import { SdkContext } from "./interfaces.js";
+import type { SdkContext } from "./interfaces.js";
```

The rewrite was driven by the compiler rather than by regex: build the
program with the flag on, collect the TS1484/TS1485/TS1205 diagnostics,
and change exactly the specifiers TypeScript names — hoisting to `import
type` when every specifier in a clause is type-only, otherwise adding an
inline `type` modifier. `tsc` then reports zero new errors against a
pre-change baseline, so no value binding was turned into a type-only
one.

One of a series of PRs, one per package, so each diff stays reviewable.
They are independent and can land in any order.

| PR | Scope |
| --- | --- |
| Azure#5127 | `samples`, `typespec-python`, `benchmark`,
`typespec-azure-playground-website`, `typespec-metadata`,
`spector-runner` |
| Azure#5128 | `azure-http-specs` |
| Azure#5129 | `typespec-autorest` |
| Azure#5130 | `typespec-azure-core` |
| Azure#5131 | `typespec-azure-resource-manager` |
| Azure#5132 | `typespec-client-generator-core` |
| Azure#5133 | `typespec-go` |
| Azure#5134 | `typespec-ts` |
| Azure#5135 | `eng/` scripts |

`typespec-autorest-canonical`, `typespec-azure-portal-core` and
`typespec-azure-rulesets` already had the flag. `typespec-java` is
deliberately left out: its `src/` is copied in at build time from
`azure-sdk-for-java`, so the flag would break its build until those
sources are migrated upstream.

Once these land, a follow-up will hoist the flag into a repo-level
`tsconfig.base.json` and drop the per-package copies, so new packages
inherit it by default.
@timotheeguerin
Timothee Guerin (timotheeguerin) marked this pull request as ready for review August 1, 2026 13:09
@xirzec
Jeff Fisher (xirzec) added this pull request to the merge queue Aug 3, 2026
Merged via the queue into Azure:main with commit dcb81cf Aug 3, 2026
34 checks passed
Chenjie Shi (tadelesh) pushed a commit to tadelesh/typespec-azure that referenced this pull request Aug 4, 2026
Type-only imports in `typespec-azure` are still emitted as runtime
imports. That leaves dead runtime edges in the emitted JS, makes module
side effects ambiguous, and blocks ever turning `verbatimModuleSyntax`
on repo-wide — something `core` has already been rolling out package by
package.

This enables the flag for **`typespec-go`** and rewrites the imports it
flags:

```diff
-import { SdkContext } from "./interfaces.js";
+import type { SdkContext } from "./interfaces.js";
```

The rewrite was driven by the compiler rather than by regex: build the
program with the flag on, collect the TS1484/TS1485/TS1205 diagnostics,
and change exactly the specifiers TypeScript names — hoisting to `import
type` when every specifier in a clause is type-only, otherwise adding an
inline `type` modifier. `tsc` then reports zero new errors against a
pre-change baseline, so no value binding was turned into a type-only
one.

One of a series of PRs, one per package, so each diff stays reviewable.
They are independent and can land in any order.

| PR | Scope |
| --- | --- |
| Azure#5127 | `samples`, `typespec-python`, `benchmark`,
`typespec-azure-playground-website`, `typespec-metadata`,
`spector-runner` |
| Azure#5128 | `azure-http-specs` |
| Azure#5129 | `typespec-autorest` |
| Azure#5130 | `typespec-azure-core` |
| Azure#5131 | `typespec-azure-resource-manager` |
| Azure#5132 | `typespec-client-generator-core` |
| Azure#5133 | `typespec-go` |
| Azure#5134 | `typespec-ts` |
| Azure#5135 | `eng/` scripts |

`typespec-autorest-canonical`, `typespec-azure-portal-core` and
`typespec-azure-rulesets` already had the flag. `typespec-java` is
deliberately left out: its `src/` is copied in at build time from
`azure-sdk-for-java`, so the flag would break its build until those
sources are migrated upstream.

Once these land, a follow-up will hoist the flag into a repo-level
`tsconfig.base.json` and drop the per-package copies, so new packages
inherit it by default.
Timothee Guerin (timotheeguerin) added a commit to chidozieononiwu/typespec-azure that referenced this pull request Aug 5, 2026
Type-only imports in `typespec-azure` are still emitted as runtime
imports. That leaves dead runtime edges in the emitted JS, makes module
side effects ambiguous, and blocks ever turning `verbatimModuleSyntax`
on repo-wide — something `core` has already been rolling out package by
package.

This enables the flag for **`azure-http-specs`** and rewrites the
imports it flags:

```diff
-import { SdkContext } from "./interfaces.js";
+import type { SdkContext } from "./interfaces.js";
```

The rewrite was driven by the compiler rather than by regex: build the
program with the flag on, collect the TS1484/TS1485/TS1205 diagnostics,
and change exactly the specifiers TypeScript names — hoisting to `import
type` when every specifier in a clause is type-only, otherwise adding an
inline `type` modifier. `tsc` then reports zero new errors against a
pre-change baseline, so no value binding was turned into a type-only
one.

One of a series of PRs, one per package, so each diff stays reviewable.
They are independent and can land in any order.

| PR | Scope |
| --- | --- |
| Azure#5127 | `samples`, `typespec-python`, `benchmark`,
`typespec-azure-playground-website`, `typespec-metadata`,
`spector-runner` |
| Azure#5128 | `azure-http-specs` |
| Azure#5129 | `typespec-autorest` |
| Azure#5130 | `typespec-azure-core` |
| Azure#5131 | `typespec-azure-resource-manager` |
| Azure#5132 | `typespec-client-generator-core` |
| Azure#5133 | `typespec-go` |
| Azure#5134 | `typespec-ts` |
| Azure#5135 | `eng/` scripts |

`typespec-autorest-canonical`, `typespec-azure-portal-core` and
`typespec-azure-rulesets` already had the flag. `typespec-java` is
deliberately left out: its `src/` is copied in at build time from
`azure-sdk-for-java`, so the flag would break its build until those
sources are migrated upstream.

Once these land, a follow-up will hoist the flag into a repo-level
`tsconfig.base.json` and drop the per-package copies, so new packages
inherit it by default.
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.

3 participants