A method returns me a class type: Widget.
I want to create a object of this type with the following code:
const wType = def.getWidgetType(); // returns Widget as type
const obj = new wType('foo'); // use the const like a normal type with parameters
getWidgetType()
public getWidgetType(): any {
return TextWidget;
}
Error
error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
Is there a "nice" version (without eval) to create a object with a given class type?
getWidgetType?getWidgetType