When running this snippet through BabelJS:
class FooError extends Error {
constructor(message) {
super(message);
}
}
let error = new FooError(\'foo\
This is a limitation due to the downlevel compilation of ES6 to ES5. Find more about this in TypeScript's explanation.
As a workaround you can do:
class QueryLimitError extends Error {
__proto__: QueryLimitError;
constructor(message) {
const trueProto = new.target.prototype;
super(message);
this.__proto__ = trueProto;
}
}
In some cases cases Object.setPrototypeOf(this, FooError.prototype);
might be enough.
You'll find more information in the corresponding Github issue and the