现在是需要当key为1的话 ,obj 为 {key1:key1} ,依次类推 现在需要简写一下代码 const getType = (type: number) => { const obj = {}; obj[`type${type}`] = type; return obj; };