Skip to content

Commit e651054

Browse files
committed
chore: enable isolatedModules
Moving the ambient const enums into real modules removed the last thing standing in the way: tsc --noEmit --isolatedModules reports 244 errors on main (all TS2748, 'Cannot access ambient const enums') and none once they are real modules. This is not emit-neutral. With isolatedModules on, tsc stops inlining const enums and emits them as runtime objects, so 33 files change: consumers go from a baked-in literal to a property lookup, and lib/constants.js now emits ShouldMigrate, NativePlatformStatus, DebugTools, TrackActionNames, BuildStates and PlatformTypes. The values are unchanged - verified at runtime - and the suite is unchanged at 1513 passing, with the CLI still rendering help and reporting its version. That change is arguably the point. oxc and esbuild cannot inline a const enum across files, so today tsc's output and every other transpiler's output disagree for exactly those six. Now they agree. It also means the const modifier on the remaining ten declarations no longer buys inlining, so it is decorative; converting them to plain enum is a sensible follow-up.
1 parent 98a0dd8 commit e651054

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"removeComments": false,
88
"noImplicitAny": true,
99
"experimentalDecorators": true,
10+
"isolatedModules": true,
1011
"skipLibCheck": true,
1112
"alwaysStrict": true,
1213
"noUnusedLocals": true,

0 commit comments

Comments
 (0)