我想在Typescript中为此类API响应创建类-
{
"genaralManager1":[
{
"deptManager1":[
{
"moduleLead1":[
{
"employee1":{
"name":"c",
"type":"emp"
}
},
{
"employee2":{
"name":"d",
"type":"emp"
}
}
],
"name":"b",
"type":"lead"
}
],
"name":"a",
"type":"manager"
},
{
"moduleLead2":[
{
"emp1":{
"name":"e",
"type":"emp"
}
}
],
"name":"f",
"type":"lead"
}
],
"name":"g",
"type":"gm"
}
我试图为Employee
,Manager
,Lead
,GeneralManager
创建类。我无法弄清楚如何处理诸如genaralManager1,deptManager1,moduleLead1,employee1等的动态键名。
有人可以帮助我创建此类吗?