Skip to content

Toggling isolatedModules in tsconfig.json while running the compiler in watch mode, doesn't re-emit const enums, unlike toggling preserveConstEnums, which does #63223

@rotemdan

Description

@rotemdan

🔎 Search Terms

isolatedModules enums not re-emitted on watch mode

🕗 Version & Regression Information

Tested on 6.0.1-rc and 6.0.0-dev.20260309

I didn't research if this is a regression or not. It may have always been like this but never reported.

⏯ Playground Link

No response

💻 Code

const enum TestEnum {
	a = 1,
	b = 3,
	c = 5,
}

const x = TestEnum.b

🙁 Actual behavior

Toggling isolatedModules doesn't change the emitted code when running tsc in watch mode. However, if the compilation is redone, it does re-emit correctly.

🙂 Expected behavior

Should modify the emitted code for const enums when the option is changed on watch mode, since it does change when re-compiling from scratch.

Additional information about the issue

For comparison, toggling preserveConstEnums in tsconfig.json does correctly modify the emitted code in watch mode.

Clarification: the issue occurs when preserveConstEnums is not defined at all in tsconfig.json, so the emit behavior for const enums is implicit from it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions