【发布时间】:2018-05-03 18:59:34
【问题描述】:
我正在尝试从 string,function 字典创建 Map 对象。
const entityTagDictionnary = [
['GRAPH_ADD_PROPERTY_SUBTYPE', (entity) => {
console.log('addSubtype called!');
return entity;
}],
['GRAPH_IGNORE_PROPERTY_SENTENCE', (entity) => {
console.log('ignore property called!');
return entity;
}],
['GRAPH_FORMAT_DATES', (entity) => {
console.log('formatDates called!');
return entity;
}],
];
const entityMap : Map<string, Function> = new Map(entityTagDictionnary);
我遇到以下错误:
Argument of type '(string | ((entity: any) => any))[][]' isn't matching the argument 'Iterable<[string, Function]>'.
我做错了什么吗?
【问题讨论】:
标签: javascript typescript