Bohužel to už nefunguje, a musí se přidat javascriptová fligna do konstruktoru https://github.com/Microsoft/TypeScript/wiki/FAQ#why-doesnt-extending-built-ins-like-error-array-and-map-work
// DO NOT WORK ANY MORE
class FooError extends Error {
constructor(m: string) {
super(m);
}
sayHello() {
return "hello " + this.message;
}
}
// HAS TO BE LIKE THIS FROM NOW ON
class FooError extends Error {
// MAGIC
constructor(m: string) {
super(m);
// Set the prototype explicitly.
Object.setPrototypeOf(this, FooError.prototype);
}
sayHello() {
return "hello " + this.message;
}
}