-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
fix(es/typescript): Support ts_enum_is_mutable
with const enums
#8171
fix(es/typescript): Support ts_enum_is_mutable
with const enums
#8171
Conversation
@@ -4581,5 +4586,7 @@ test!( | |||
})(D || (D = {})); | |||
D.A = 5; | |||
console.log(D.A); | |||
var E; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improvement for swc in the future might be to not emit this for const enums.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
swc-bump:
- swc_ecma_transforms_typescript
enum Foo {
A = 2
}
const enum Bar {
B = Foo.A
}
console.log(Bar.B) Could you add this test case? |
(function(I) { | ||
I[I["A"] = H.A] = "A"; | ||
})(I || (I = {})); | ||
console.log(I.A); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not ideal, but it's ok output. It's a rare edge case for someone to use an enum in a const enum.
@magic-akari good idea! I added a test for that and for the opposite. |
Description: Bug I introduced in https://github.com/swc-project/swc/pull/8115/files (it was not implemented correctly)