Skip to content

fix: add affectsEmit/affectsBuildInfo/affectsSemanticDiagnostics to isolatedModules option#63249

Open
GokhanKabar wants to merge 1 commit intomicrosoft:mainfrom
GokhanKabar:fix/isolatedModules-affectsEmit
Open

fix: add affectsEmit/affectsBuildInfo/affectsSemanticDiagnostics to isolatedModules option#63249
GokhanKabar wants to merge 1 commit intomicrosoft:mainfrom
GokhanKabar:fix/isolatedModules-affectsEmit

Conversation

@GokhanKabar
Copy link

Fixes #63223

Problem

Toggling isolatedModules in tsconfig.json while running tsc --watch did not trigger re-emission of files containing const enum declarations. A fresh compilation produced the correct output, but watch mode left stale JS files.

Root cause

The isolatedModules option declaration in commandLineParser.ts was missing affectsEmit: true, affectsBuildInfo: true, and affectsSemanticDiagnostics: true.

As a result, compilerOptionsAffectEmit() returned false when only isolatedModules changed, so the builder never marked files as pending re-emit.

isolatedModules directly affects const-enum emit: when enabled, tryGetConstEnumValue in transformers/ts.ts always returns undefined, preventing value inlining; when disabled, values are inlined. The closely related
verbatimModuleSyntax and preserveConstEnums options already carry these flags — this aligns isolatedModules with them.

…solatedModules option

Toggling `isolatedModules` in `tsconfig.json` while in watch mode did not
trigger re-emission of files containing `const enum` declarations. A fresh
compilation produced the correct output, but watch mode left stale JS files.

Root cause: the `isolatedModules` option declaration in `commandLineParser.ts`
was missing `affectsEmit: true`, `affectsBuildInfo: true`, and
`affectsSemanticDiagnostics: true`. As a result, `compilerOptionsAffectEmit()`
returned `false` when only `isolatedModules` changed, so the builder never
marked files as pending re-emit.

`isolatedModules` directly affects const-enum emit: when enabled,
`tryGetConstEnumValue` (transformers/ts.ts) always returns `undefined`,
preventing inlining; when disabled, values are inlined. The option already
had these flags on the closely related `verbatimModuleSyntax` and
`preserveConstEnums` options — this aligns `isolatedModules` with them.

Fixes microsoft#63223
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Not started

1 participant