Closed
Description
TypeScript Version:
Version used: 3.3.3333
I have reproduced this using typescript/@next
which at the time of writing is 3.4.0-dev.20190319
Search Terms:
object.values
object.values enum
enum values
Code
enum DirectionNumber {
Down,
Neutral,
Up
}
console.log(Object.values(DirectionNumber);
// output ["Down", "Neutral", "Up", 0, 1, 2]
Expected behavior:
Expecting consistent output, logging the enum values correctly.
This expected behaviour is also shown in the provided playground where I compare it with the erroneous behaviour.
Actual behavior:
When Object.values
gets passed an enum with numbers as values, the resulting array contains both these numbers AND the keys. This seems unintuitive and unintended behaviour.
Playground Link:
Related Issues: