I have a base class, that is extended in multiple different classes
and i have an array that houses a bunch of different objects contructed from those different classes.
So now i want to have a function where i can give a class as an input and then get all the elements of the array that got constructed from that class.
class Test {}
class TestA extends Test {}
class TestB extends Test {}
class Testc extends Test {}
let array: Test[] = [];
// randomly add TestA, TestB, TestC
function getOfType(type: ???): Test[] {
// magically get all of the ones that are of that type
}
// expected:
getOfType(TestA) // -> [TestA, TestA, TestA]```