Factory returning classes in TypeScript
问题 Wrote a library that, depending on the input data; creates classes and uses them inside a main class. To make the code more maintainable and readable, I've moved the class generation logic into a separate file that exports a factory function. Code was written in ES2015. Now I'm migrating to TypeScript. Here is a pseudo example: factory.ts export default function (foo:string) => { class A { value:string = foo + '-A'; } return { A }; }; Main.ts import factory from './factory'; export default