Closed
Description
Enums currently get outputted to an object with two-way mapping of numbers. This makes it hard to iterate through the names (or values) of an enum. A method on the enum object to get the keys of the enum would allow iterating.
See this StackOverflow question for a use case of iterating. (And use of a regular expression for filtering).
Possible Solutions:
Add a length property (for enums with default index)too limited- Function on enum type filtering keys looking for numbers (could break with other index types)
- Add a function with the keys hard coded when compiling
Complications:
- User defined indexing
- Negative index numbers
- Proposals for other index types (Proposal: String enums #3192, Allow enums of types other than number #1206, Index signature parameter type should allow for enums #2491)