Open
Description
Bug Report
π Search Terms
Computed property names are not allowed in enums
enum declaration computed
π Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about enums
β― Playground Link
Playground link with relevant code
π» Code
let y = "y";
type z = "z";
enum Foo {
['x'],
[{}],
[y],
[z]
}
π Actual behavior
TS reports Computed property names are not allowed in enums.
for [{}]
, [y]
and [z]
, while it allows ['x']
(in contraddiction with the error message).
π Expected behavior
All of them should be an error, for the reason reported by the error.
π Context
This came up at babel/babel#12683: we can implement the current TS behavior in Babel, but I'd first like to check if TS is expected to report an error for ['x']
.