I have a setup like this:
enum PokemonType {
Dark = "DARK"
Light = "Light"
}
const pokemonTypes: {[key: string]: PokemonInfo} = {
"DARK": {
info: "Dark is bad",
color: "black"
},
"Light": {
info: "Light is good",
color: "white"
}
}
interface Pokemon {
type: PokemonType,
// !!Some kind of function here to use type
// to index into pokemonTypes.!!
}
See the comment above in Pokemon. Basically I want a function in the Pokemon interface to use the type key to index into the pokemonTypes const. How could I do this? Thanks!