Call constructor on TypeScript class without new
What about this? Describe the desired shape of MyClass and its constructor: interface MyClass { val: number; } interface MyClassConstructor { new(val: number): MyClass; // newable (val: number): MyClass; // callable } Notice that MyClassConstructor is defined as both callable as a function and newable as a constructor. Then implement it: const MyClass: MyClassConstructor = … Read more