Consider the code below. I assumed that i could loop through an enum and pass an instance of it to a function that takes the enum as parameter.
However, it seems that let color in Colors produced color of type string instead of type Colors. Am I missing a cast somewhere? Why doesn't enum loop produce a value of said Enum?
enum Colors {
Red = "Red",
Green = "Green",
Yellow = "Yellow"
}
for (let color in Colors) {
doStuff(color);
}
function doStuff(mycolor: Colors) {
console.log(mycolor)
}