1/** 2 * @file objToArray 3 * 4 * 将对象按照要求转为数组 5 * 注意console示例运行结果 6 */ 7type Obj = Record<string, string>; 8interface FormatItem { 9 key: string; 10 op: string; 11 value: string; 12} 13 14function objToArray(obj: Record<string, Obj>): FormatItem[] { 15 // 补全此处代码 16 throw new Error("功能待实现"); 17} 18 19console.log( 20 objToArray({ 21 key1: { 22 op1: "value1", 23 }, 24 key2: { 25 op2: "value2", 26 }, 27 }) 28); 29// result示例 30// [ 31// {key: 'key1', op: 'op1', value: 'value1'}, 32// {key: 'key2', op: 'op2', value: 'value2'} 33// ] 34 35export default {};