fix: add affectsEmit/affectsBuildInfo/affectsSemanticDiagnostics to isolatedModules option#63249
Open
GokhanKabar wants to merge 1 commit intomicrosoft:mainfrom
Open
fix: add affectsEmit/affectsBuildInfo/affectsSemanticDiagnostics to isolatedModules option#63249GokhanKabar wants to merge 1 commit intomicrosoft:mainfrom
GokhanKabar wants to merge 1 commit intomicrosoft:mainfrom
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #63223
Problem
Toggling
isolatedModulesintsconfig.jsonwhile runningtsc --watchdid not trigger re-emission of files containingconst enumdeclarations. A fresh compilation produced the correct output, but watch mode left stale JS files.Root cause
The
isolatedModulesoption declaration incommandLineParser.tswas missingaffectsEmit: true,affectsBuildInfo: true, andaffectsSemanticDiagnostics: true.As a result,
compilerOptionsAffectEmit()returnedfalsewhen onlyisolatedModuleschanged, so the builder never marked files as pending re-emit.isolatedModulesdirectly affects const-enum emit: when enabled,tryGetConstEnumValueintransformers/ts.tsalways returnsundefined, preventing value inlining; when disabled, values are inlined. The closely relatedverbatimModuleSyntaxandpreserveConstEnumsoptions already carry these flags — this alignsisolatedModuleswith them.