-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
const/non-const enum cleanup #2183
Comments
Note this would likely be a breaking change |
A retelling of how we got here (note: using "1.0" here as a stand-in for all behavior prior to Vlad's proposed PR which does more aggressive initializer folding) For regular enums, in 1.0, we would only inline constant members, and a member was only constant if its initializer was a literal. This led to a "workaround" (or "design feature", depending) that you could use an equivalent syntactic form to get a computed enum member, e.g. Vlad's change more aggressively resolves computational expressions in enum member initializers, so the member One proposed workaround was that you would initialize your "should not be inlined" enum members via a function call (e.g. The cleanest place to land is that we treat all non- |
Ref #2594 |
Key points from discussion from this morning:
const
enums are computed (even those initialized with literals), both for inlining purposes and for .d.ts generation purposesconst
and non-const
enumsconst
enums but does not change inliningTag @ahejlsberg
The text was updated successfully, but these errors were encountered: