I have the following code:
class Base<T> {}
class Test {
prop: Base<any>;
createProp<T>() {
this.prop = new Base<T>();
}
}
const test = new Test();
test.createProp<{ a: number }>();
test.prop // Base<any> expected Base<{ a: number }>
When I call createProp with the generic, I want it to be the new type of the prop property. Currently, after running this method, the type is still - Base<any>. There is a way to do it with TS?