A dictionary can be easily expressed in TypeScript using the following interface:
interface IDictionary {
[index:string]: string;
}
You can use it as follows:
var example: IDictionary = {
"key1": "value1",
"key2": "value2"
}
var value1 = example["key1"];
The general dictionary allows any set of key / value pairs, so you do not need to explicitly describe the exact combination, this makes it very similar to the dictionary in the source (that is, it does not promise to have a value for the given key).
, ... :
interface IDictionary<T> {
[index:string]: T;
}