Can we use reflection in Type Script just like C# to get the list of classes which implement a certain base class?
For example, let say Snake and Horse implement the base class Animal. Now I need to get classes which implement Animal. Similar to what we can do in C#:
C# equivalent Code:
var childTypes = assembly.GetTypes().Where(_ => _.IsSubclassOf(typeof(Animal)));
Type Script classes:
class Animal {
}
class Snake extends Animal {
}
class Horse extends Animal {
}
Aucun commentaire:
Enregistrer un commentaire