So I'm trying to create an object which has an arreay of projects I want projects to be a generic of but I'm getting error unresolved type T:
export class AllocationInvestorVO {
public name: string;
public id: string;
public projects: Array<T>; //ERROR: unresolved type T
}
What I am aiming for is the polymorphism behavior we see in Java, that we can create a List object which can be extended to ArrayList for example:
How to Create an Array that Base type is for example Project and it can be polymorphed into Array of type ProjectX or ProjectY.
If you want the
projectsto be generic then you need to first declare theAllocationInvestorVOclass as generic:Otherwise
Tcan't be resolved.If you want to have a base for this
Tthen: