我明白这与Typescript的本意恰恰相反,但我希望能够通过程序从Typescript接口中生成一个对象。基本上,我想要像这样的东西:
interface Foo {
bar: string
}
const generateObjFromInterface = (Foo) => // { bar: 'string'}
如果可能的话,实现方式有多矫揉造作也没关系!如果这是明确不可能的,那也是有帮助的信息!
提前感谢!