Skip to content

Bring back const enums #533

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

Closed
taralx opened this issue Jul 20, 2022 · 4 comments
Closed

Bring back const enums #533

taralx opened this issue Jul 20, 2022 · 4 comments

Comments

@taralx
Copy link

taralx commented Jul 20, 2022

History: #295

So there was a transpilation bug (microsoft/TypeScript#40499) that some people ran into, but that was fixed in Typescript 4.2. It should be possible to set preserveConstEnums and get the best of both worlds. I wouldn't be so bothered except my bundle size (via parcel) goes from 3k to 27k because it pulls in the whole big chunk for just a few numbers.

@IRONM00N
Copy link
Contributor

Even with preserveConstEnums enabled, ts doesn't allow reverse mapping for const enums.

@taralx
Copy link
Author

taralx commented Jul 21, 2022

@vladfrangu
Copy link
Member

const enums have been very much a pain point in the library (and in the TypeScript ecosystem as a whole).

Read more: microsoft/TypeScript#30590

image

As such, we will not bring them back. I'd be more worried why parcel or whatever bundler you use doesn't treeshake properly (is this our fault? Is it something else?)

Feel free to open an issue (or even a pull request) if treeshaking fails, and a repository to test it with, and we'll take a look :D

@vladfrangu vladfrangu closed this as not planned Won't fix, can't repro, duplicate, stale Jul 21, 2022
@taralx
Copy link
Author

taralx commented Jul 21, 2022

That's fair. Thank you for the detailed response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants