I would like to dynamically define a type like this from a list of currency ids:
{
usd: number;
usd_mcap: number;
eur: number;
eur_mcap: number;
gbp: number;
gbp_mcap: number;
}
I have the following, but I cannot figure out how to add the {currency}_mcap property to the object:
type CurrencyId = 'usd' | 'eur' | 'gbp';
type AssetInfo = {
[key in CurrencyId]: number;
} & {
[(key + '_mcap') in CurrencyId]: number; // This does not work
}
Any ideas what I can try?