How can I determine if two objects are of the same type (ie the same class)? The objects can be any of about 20 different classes so I don't want a giant test going, both instanceof A, both instanceof B, ... But there's no GetType()/getClass() in typescript.
thanks - dave
Just use the constructor property. Reference : http://basarat.github.io/this-and-prototype/#/reflection 
class Animal {}
class Bird extends Animal {}
var animal = new Animal();
var bird = new Bird();
console.log(animal.constructor == Animal); // true 
console.log(bird.constructor == Bird); // true
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With