I have such simple class where I am trying to constrain the type of the object inside my class using generic type (Dog in this case). I expect to see the compilation error here box.put(cat) because I pass the wrong type but unfortunately, I don`t see any.
class Box<T>{
content: Array<T> = [];
put(animal: T){
this.content.push(animal);
}
}
var dog = new Dog();
var cat = new Cat();
var box = new Box<Dog>();
box.put(cat);