作者:coolbreeze | 来源:互联网 | 2023-05-19 15:01
Idliketousestringindexofinterface.我想用接口的字符串索引。interfaceIDictionary{[index:string
I'd like to use string index of interface.
我想用接口的字符串索引。
interface IDictionary {
[index: string]: string;
}
var params: IDictionary;
params = [{ "heart": "HP" }, { "mana": "MP" }];
console.log(params);
I thought this might be like MAP such as a pair of key and value. I'm not sure this is correct approach.
我想这可能像映射,比如一对键和值。我不确定这是正确的方法。
1 个解决方案