I have a list of animals in an enum that I want to use to declare specific types. For instance:
enum Animals {
CAT = 'cat',
DOG = 'dog',
}
Based on this Animal
enum, I wish to declare a type structure like so:
type AnimalType = {
cat_price: string,
cat_from: string,
cat_color: string,
dog_price: string,
dog_from: string,
dog_color: string,
}
Is there a way to dynamically update the AnimalType
whenever the values in the Animals
enum change?
Any insights or suggestions would be greatly appreciated.