About the usage of TypeScript

about TypeScript. See the code below.

interface MyInterface { }

class MyClassA implements MyInterface { }

class MyClassB implements MyInterface { }

const createMyInterface = (_interface: any) => {
  return new _interface();
}

createMyInterface(MyClassA);
createMyInterface(MyClassB);
What I want to achieve is that when I call the createMyInterface () method, I can clearly indicate that what I need to pass is a definition of implements class interface MyInterface interface.

how can I write any here in _ interface: any ?

Mar.14,2021

interface MyInterface { }
class MyClassA implements MyInterface { }
class MyClassB implements MyInterface { }
const createMyInterface = (_interface: MyInterface) => {
  return new _interface();
}

createMyInterface(MyClassA);
createMyInterface(MyClassB);
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eafe75-46fd4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eafe75-46fd4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?