Imagine I have an object containing a set of values:
const my_enum = {
value1: 'x-value-1',
value2: 'x-value-2'
}
I am looking to define an interface or type using 'x-value-1' and 'x-value-2' as keys, like so:
interface my_interface {
'x-value-1': string;
'x-value-2': string;
}
However, I prefer not to rely on my enum for determining the keys in order to use them throughout my code. Is there a method to achieve something akin to this?
interface my_interface {
`${value1}`: string;
`${value2}`: string;
}