enum AnimalType {
  CAT,
  DOG,
}

interface AnimalEnum {
  [AnimalType.CAT]: {
    name: 'cat',
    weight: 6,
  };
  [AnimalType.DOG]: {
    name: 'dog',
    weight: 20
  };
}

const animal: AnimalEnum[AnimalType] = {
  name: 'cat',
  weight: 6
}
Last modification:June 8, 2022
If you think my article is useful to you, please feel free to appreciate