-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
DuplicateAn existing issue was already createdAn existing issue was already created
Description
Search Terms
string enum
default value
initializer
infer
Suggestion
Add syntactic sugar to string enum declarations to infer their values from their key names. The overwhelming majority of string enum values are identical or near-identical to their key names, and it's kludgy to list every reserved value twice in its declaration.
enum<string> Foo {
A,
B,
...,
Y = 'LegacyOverrideYValue',
Z,
LongAndSimilarEnumName,
LongUnsimilarEnumName,
}
// instead of
enum Foo {
A = 'A',
B = 'B',
...,
Y = 'LegacyOverrideYValue',
Z = 'Z',
LongAndSimilarEnumName = 'LongAndSimilarEnumName',
LongUnsimilarEnumName = 'LongUnSimilarEnumName',
}
// which contains a sneaky bug
Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already created