假设我们有两个变量
const x='属性1'
const y='属性2'
还有一个函数
function foo<key extends keyof MapInterface>(name: key, props: (MapInterface[key]))
这个界面应该长成这样
interface MapInterface{
'property1':any;
'property2':any;
}
是否可以通过调用变量x,y来泛型创建接口?
interface MapInterface{
x:any; //return 'property1':any;
y:any; //return 'property2':any;
}