To use my color enum in my theme, I have to declare its type.
I tried this:
enum COLORS {
PRIMARY = '#FF7900',
}
type ColorsType = {
[key in keyof typeof COLORS]: COLORS[key] // error
}
interface ThemeColors extends ColorsType {}
But I'm getting this error: TS2536: Type 'key' cannot be used to index type 'COLORS'
It's working if I use string instead of COLORS[key], but I don't want the type to allow any string for any COLORS property.