To convert TypeScript enum to an object array, we use the Object.values
method.
For instance, we write
enum Colors {
WHITE = 0,
BLACK = 1,
BLUE = 3,
}
const colorValueArray = Object.values(Colors);
to call Object.values
with the Colors
enum to return the values in the enum as an array.