I have an abstract class Foo:
abstract class Foo {
constructor() {
// ...
}
}
I don't want classes that extend Foo to be able to implement a new constructor:
class Bar {
constructor() { // Error: can't implement a constructor
super();
console.log("hello from Bar's constructor!").
}
}
How can I achieve this with typescript? private constructors forbid extension altogether. protected constructors allow custom constructors in extending classes.