Recently, I came across a particular dataset that looks like this:
{
Europe: {
WestEurope: {
Belgium: [French, English, Dutch]
}
}
}
I'm grappling with the challenge of creating an interface for such a dynamic structure, which essentially forms a tree-like hierarchy:
Object->Object(of Regions)->Object(of SubRegions)->Object(of Countries)->ArrayOfStrings(of languages)
My initial attempt involved defining interfaces as follows:
export interface Localisation {
[key: string]: Localisation;
}
export interface Region {
[key: string]: Region;
}
export interface SubRegion {
[key: string]: SubRegion;
}
export interface Country {
[key: string]: Country;
}
export interface Language {
[index: number]: Array<string>;
}
However, these interfaces aren't 'chained' together - meaning 'Localisation' doesn't inherently understand that it contains 'Regions', and so on. I'm looking for a way to establish connections between them. Is this feasible?