Can you guide me on how to access the value of the generic, static variable animalType in T.animalType from the given example code below?
export class main {
constructor() {
var myWorker: worker = new worker();
myWorker.whatAmI();
}
}
export class worker extends workerBase<dog> {
}
export class workerBase<T extends animal>
{
public whatAmI() {
//output animal type as "dog"
console.warn("Animal type: " + T.animalType); // <<-- this will NOT work, but this is what I want to achieve
}
}
export class animal {
public static animalType: string = "any";
}
export class dog extends animal {
public static animalType: string = "dog";
}