class Icons{
static homeIcon = "<svg...";
static backIcon = "ico/back.png";
}
class Menu{
addItem(icon: ????){....}
}
If you want to force the icon parameter in Menu.addItem to be a member of the Icons class, what type declaration should you use?
Currently, this is what I have:
addItem(icon:[keyof typeof Icons]);
menu.addItem("homeIcon", someFunction);
This code approximates and validates using the property names as strings. However, is there a way to declare a type that would allow me to directly reference the properties of the Icons class like this:
menu.addItem(Icons.homeIcon, someFunction);
I have a feeling that I might be overlooking something fundamental here.