我有一个接口,我基本上想要一个哈希array.类似这样(可能不正确):
export interface EntitySpec {
originId: EntityType;
mandatoryProperties: Array<{ [key: string]: string }>;
}
但我想应用这样的界面:
const spec: EntitySpec = {
originId: 1,
mandatoryProperties: {
'code': 'sad',
'name': 'this',
'comment': 'here',
},
};
但我得到了这个:输入"{code:string;}"不可分配给类型"{[key:string]:string;}[]'.