Is there a type for “Class” in Typescript? And does “any” include it?

后端 未结 7 827
渐次进展
渐次进展 2020-12-07 18:34

In Java, you can give a class to a method as a parameter using the type \"Class\". I didn\'t find anything similar in the typescript docs - is it possible to hand a class to

7条回答
  •  猫巷女王i
    2020-12-07 19:08

    Following worked for me:

    type ClassRef = new (...args: any[]) => any;
    

    my use case:

     interface InteractionType { [key: string]: ClassRef; }
    

提交回复
热议问题