-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Open
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Error MessagesThe issue relates to error messagingThe issue relates to error messaging
Milestone
Description
Bug Report
π Search Terms
Computed property names are not allowed in enumsenum 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'].
armano2, RyanCavanaugh, a-tarasyuk and leegeunhyeok
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Error MessagesThe issue relates to error messagingThe issue relates to error messaging