Here is the live demo: https://codesandbox.io/s/vigorous-rgb-u860z?file=/src/index.ts
enum Keys {
One = "one",
Two = "two"
}
const a = Object.values(Keys).map((value, index) => ({
label: value,
id: String(index)
})) as const;
Here is the error message
A 'const' assertions can only be applied to references to enum members, or string, number, boolean, array, or object literals.
I am not sure what I am missing here since Object.values indeed returns an array. Why can't I make const assertion on it