You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The emitted code is not the same when using isolatedModules.
🙂 Expected behavior
The emitted code should be the same when using isolatedModules as it is described as nothing else but a check
Setting the isolatedModules flag tells TypeScript to warn you if you write certain code that can’t be correctly interpreted by a single-file transpilation process.
const enum values should be inlined even when using this flag. (Or an error should be emitted).
Additional information about the issue
From the documentation:
It does not change the behavior of your code, or otherwise change the behavior of TypeScript’s checking and emitting process.
Which is not true, at least for const enum as this prevents inlining.
See the playground link and #16671 (comment)
The text was updated successfully, but these errors were encountered:
🔎 Search Terms
isolatedModules
const enum
inlining
generated code
🕗 Version & Regression Information
⏯ Playground Link
https://www.typescriptlang.org/play/?preserveConstEnums=true&module=5&isolatedModules=true&ts=5.7.0-dev.20240930#code/FAYw9gdgzgLgBAUwgVwLZwHJhgZTAQQHcEoxUEBhSWAURXQG9g449yA1AQwBtkEAaZnHwRsACwQAnAPIQEwAL7BlAM2QQQMAJaQ4AEzClyMMVogBzABSxOMBAC5M2PERJlK1GHTQBKRwDcwLT04JhYoQi0YEDE4axhbBB9QoRYQTigEJ1wCYiMPaC96ADo2BC5eB1SWOHBoMG4EYu4wKwByMoq+Np8AbmqWACNJBE4Aa36a2oysrBzXfKpC71RikXEpWSqptOoGppb29ZNNuR7JneHRiaElBSA
💻 Code
🙁 Actual behavior
The emitted code is not the same when using
isolatedModules
.🙂 Expected behavior
The emitted code should be the same when using
isolatedModules
as it is described as nothing else but a checkconst enum values should be inlined even when using this flag. (Or an error should be emitted).
Additional information about the issue
From the documentation:
Which is not true, at least for
const enum
as this prevents inlining.See the playground link and #16671 (comment)
The text was updated successfully, but these errors were encountered: