I would like to store a mapping of string -> string in a Typescript object, and enforce that all of the keys map to strings. For example:
var stuff = {};
stuff["a"] = "foo"; // okay
stuff["b"] = "bar"; // okay
stuff["c"] = false; // ERROR! bool != string
Is there a way for me to enforce that the values must be strings (or whatever type..)?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…