-
-
Notifications
You must be signed in to change notification settings - Fork 393
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
Remove unused transpiled Typescript enum #1177
Comments
One solution would of course be to fix TSC/Babel/swc to instead do something using var Rec = /*@__PURE__*/ (function (Rec) {
Rec[Rec["A"] = 123123] = "A";
Rec[Rec["B"] = 123124] = "B";
Rec[Rec["C"] = 123125] = "C";
Rec[Rec["D"] = 123126] = "D";
return Rec;
})({}); but I imagine this |
That's for enum declaration merging. FWIW that's easy to solve for too: microsoft/TypeScript#27604 (comment). You just need to change |
@evanw Great to hear that this is working without problems in esbuild! I might try to change this for swc and Babel. Related Babel issue: babel/babel#9268 |
This is a construct that I think is too tricky to address in general, but Terser already supports another TS pattern of using the identity function to avoid repeating So this specific usage can be addressed specifically IMO. |
Looks like this will be fixed on the babel side: babel/babel#15467 |
Lovely! |
Bug report or Feature request?
sub-optimal output
Version (complete output of
terser -V
or specific git commit)5.12.1
Complete CLI command or
minify()
options usedterser -mc --module --toplevel index.js
terser
inputterser
output or errorExpected result
Is there any change this could be removed (because
Rec
is unused)? This would have a rather high impact because it applies to all Typescript enums.The text was updated successfully, but these errors were encountered: