I have this Javascript object:
var termsAndConditions = {
pt: ["url1", "url2"],
en: ["url3", "url4"]
}
I am looking to elegantly convert it into Typescript in just one line. Here is what I came up with:
const termsAndConditions: {[countryKey: Array<string>]} = {
pt: ["url1", "url2"],
en: ["url3", "url4"]
}
After that, I would like to access the URLs for different languages like so:
const ptUrls: Array<string> = termsAndConditions.pt;
const enUrls: Array<string> = termsAndConditions.en;
Is there a better way to achieve this?