I have two classes:
class Bar extends Foo { // Foo isn't relevant
  constructor(value) {
    if (!(value instanceof Foo)) throw "InvalidArgumentException: (...)";
    super();
    this.value = value;
  }
}
class Baz extends Bar {
  constructor(value) {
    super(value);
  }
}
The Bar constructor checks if value is an instance of Foo, it throws an error if it isn't. At least, that's what I wanted it to do. If you pass a Bar or a Baz as value, the if-statement returns true as well. The goal is to only let Foos through.
I found this answer already but that didn't really answer my question.
 
     
     
     
     
     
     
    