microsoft / microsoft/TypeScript
Toggling `isolatedModules` in `tsconfig.json` while running the compiler in `watch` mode, doesn't re-emit `const enums`, unlike toggling `preserveConstEnums`, which does
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.3k
- Merge medio
- 2g 4h
- PR unite (30g)
- 132
Descrizione
### 🔎 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
```ts
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 enum`s is implicit from it.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Riprodurre l’esempio di const enum fornito con tsc in modalità watch, modificando prima isolatedModules e poi preserveConstEnums in tsconfig.json. Confrontare l’output emesso con una nuova compilazione, quindi tracciare la configurazione della modalità watch e i percorsi di invalidazione dell’emissione. Il lavoro è completato quando la modifica di isolatedModules fa sì che i const enums vengano emessi nuovamente senza richiedere un riavvio completo.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- typescript
- Ambito
- build-system, compilers
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 38/100