-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureThis means we'd like to hear from more people who would be helped by this featureSuggestionAn idea for TypeScriptAn idea for TypeScript
Description
I want to use values of a const enum to define object literals
** Syntactic **
const enum E {
Aa = 1, Bb = 2
}
let obj = {
E.Aa: "action a",
E.Bb: "action b",
};Emit
let obj = {
1: "action a",
2: "action b",
};Compatibility
Since JS supports string literals keys, and strings containing . is not a valid id, we may limit the usage of const enums to "EnumTypeName.EnumValueName" to avoid ambiguities. And then,
{ e_Aa: 1 }is{ "e_Aa": 1}{ E.Aa: 1 }is{ 1: 1}{ "E.Aa": 1 }is{ "E.Aa": 1}
morninng, boyski33, pmkyl, ragaar, daniel-bikemap and 17 morecshaa
Metadata
Metadata
Assignees
Labels
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureThis means we'd like to hear from more people who would be helped by this featureSuggestionAn idea for TypeScriptAn idea for TypeScript