typescript template restrictions code example
Example: Generic constraint on constructor function
function createInstance<T>(t: new () => T): T {
return new t();
}
class Test {
x: number = 4;
}
let test: Test = createInstance(Test);
console.log(test);