I want to have data that would be as follow
paymentProviderByCountry = {
England: worldPay,
Spain: worldPay
}
How do I create the interface for paymentProviderByCountryObj that integrates paymentProvidersList and countryList in my desired dynamic format.
I guess what I am looking for is how do I create recursively the obj
enum paymentProvidersList {
WorldPay,
Paypal,
}
enum countryListEnum {
England,
France,
Spain,
}
type T0 = { [key in paymentProvidersList]: string }; // This would work
/*
I want the values on paymentProviderByCountryObj to be dynamic based on the
enum values so that i can have an object that looks like this
paymentProviderByCountry = {
England: WorldPay,
Spain: Paypal,
France: WorldPay
}
*/
interface paymentProviderByCountryObj {
// This is the complex case, i cant get the index of the class to be dynamic and also its value
[key in countryListEnum] :string : { [key in paymentProvidersList]: string };
}
export interface sysConfigInterface {
paymentProviders: paymentProvidersList,
paymentProviderByCountry: paymentProviderByCountryObj,
minPaymentThreshold: String,
}