关于TypeScript。见下面的代码。
interface MyInterface { }
class MyClassA implements MyInterface { }
class MyClassB implements MyInterface { }
const createMyInterface = (_interface: any) => {
return new _interface();
}
createMyInterface(MyClassA);
createMyInterface(MyClassB);
我想实现的是,在调用 createMyInterface()
方法的时候,可以明确提示出,需要传递的是一个 implements
了 MyInterface
接口 的 类 的定义。
请问在 _interface: any
这里的 any
可以换成什么写法?