There is Props interface from third-party:
interface Props {
id: string;
name: string;
age: number;
approval: Approval
}
interface Approval {
signature: string;
}
What is the solution that Props convert to array:
[
{
name: 'id',
type: 'string'
},
{
name: 'name',
type:'string'
},
{
name: 'age',
type: 'number'
},
{
name: 'approval',
type: 'Approval'
}
]
I have no idea that Typescript's interface can do this?
Update: Maybe it is not 'convert', somehow it just like 'reflect' or something else. Can I do this in babel?
However, I just want to get this array by Props.
Finally, I solved this problem through TS Compile API: