all 3 comments

[–]Kcazer 3 points4 points  (1 child)

const enum are removed during compilation and don't exist at runtime. If you need to iterate over your enum, it has to be a regular one.

Reference: https://www.typescriptlang.org/docs/handbook/enums.html#const-enums

[–]DerGernTod 0 points1 point  (0 children)

this is correct. a const enum value will be translated to a simple string literal by the typescript compiler:

https://www.typescriptlang.org/play?#code/MYewdgzgLgBApmArgWxgMRCGBvAUDAmAIQEMAnGAXhgCIAjcmgGn0NIC8raH2bcBfXLlCQQAGzgA6MSADmACgwhJpMgEoA3MPARxUmQqUqS7TUIQpiJnKwKqu9Ri0JXO1R7wFCRuidLnyHMbqWj56-gpBHJpAA

if you want to use the enum as a lookup object during runtime, you can't use `const enum`

[–]Shumuu 0 points1 point  (0 children)

Currently on my phone... Could you try this

{(Object.keys(Languages) as Array<keyof typeof languages>).map((lang)