Skip to content

Enable verbatimModuleSyntax for eng scripts - #5135

Merged
timotheeguerin merged 1 commit into
Azure:mainfrom
timotheeguerin:vms/eng
Jul 31, 2026
Merged

Enable verbatimModuleSyntax for eng scripts#5135
timotheeguerin merged 1 commit into
Azure:mainfrom
timotheeguerin:vms/eng

Conversation

@timotheeguerin

@timotheeguerin 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 the eng/ scripts (tsconfig.eng.json) 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.

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

No changes needing a change description found.

@azure-sdk-automation

Copy link
Copy Markdown
Contributor

You can try these changes here

🛝 Playground 🌐 Website

@timotheeguerin
timotheeguerin marked this pull request as ready for review July 31, 2026 21:45
@timotheeguerin
timotheeguerin enabled auto-merge July 31, 2026 21:56
@timotheeguerin
timotheeguerin added this pull request to the merge queue Jul 31, 2026
Merged via the queue into Azure:main with commit c34c634 Jul 31, 2026
40 of 41 checks passed
@timotheeguerin
timotheeguerin deleted the vms/eng branch July 31, 2026 23:27
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.
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.
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.
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.
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants