Reputation: 10929
I have an enum
export enum A{
X = 'x',
Y = 'y',
Z = 'z'
}
I want this to be converted to
[A.X, A.Y, A.Z]
Type of the array is A[]. How to do this?
Upvotes: 7
Views: 15337
Reputation: 41
You can use Object.values to get value of enum
enum A {
X = 'x',
Y = 'y',
Z = 'z'
}
let arr = Object.values(A)
console.log(arr);
Upvotes: 4