I am trying to create instance from generic type T
for example,
class Factory {
public static generate<T>(): T {
return new T();
}
}
But since T
is just a type not constructor, we can't do that.
Is it impossible to create an instance from a generic type in TypeScript?
I'v also read these articles but could not found a solution.