class a extends schema {
fun1 () => 1
}
class b extends schema{
fun2 () => 2
}
const objs = {
a:new a
b:new b
}
function find(key) : any{
return objs[key]
}
这个 objs 很多个 obj 他们都继承自同一个父类,有什么办法在调用 find 返回的对象能保持代码提示吗?
let obj = find('a')
obj.fun1 //代码提示