Returning a Type as a Variable in TypeScript
问题 I'm currently writing a class factory in TypeScript, and would like to return a type as the output of a function. Although TypeScript handles types as an input--i.e. generics--beautifully, I've not yet found a way to handle types as an output. This StackOverflow question on class factories offered a particularly helpful solution, but did not fully answer my question. Given the below structure, function factory(someVar: any) { return class A { // Do something with someVar that makes this class