I have a Market class
which has only 1 parameter: name.
class Market {
name: string
constructor(name: string) {
this.name = name
}
}
I then have a Markets class
which is a static
collection of several markets.
class Markets {
static M1 = new Market("M1M")
static M2 = new Market("M2M")
static M3 = new Market("M3M")
}
I was wondering if there was a way to extract all name parameters from all markets into a type, such that the type would look something like this:
type MarketNames = "M1M" | "M2M" | "M3M"
I know about the keyof
operator, is it the way?
Thanks.