how to use C# dictionary in typescript?
You can do something like this:
let lengthsByCountry: { [key: string]: number; } = {};
Then initialize the items:
lengthsByCountry["AD"] = 24;
There's no direct mapping for the inline initialization at present, as far as I know.
You can use Map object. Map is a new data structure introduced in ES6 which lets you map keys to values without the drawbacks of using Objects.
For example
let map = new Map();
map.set("A",1);
map.set("B",2);
map.set("C",3);
It's just a javascript object.
export interface Dto {
lengthsByCountry: { [name: string]: string };
}