0
不應該這樣做嗎?實現字典式的類
interface IDictionary {
[index: string]: string;
}
class Dictionary implements IDictionary {
public foo = "bar";
}
相反,我發現了錯誤:
TS2420:Class 'Dictionary' incorrectly implements 'IDictionary'. Index signature is missing in type 'Dictionary'.