Skip to content

Commit 263e640

Browse files
committed
Fix error prototype chain
1 parent b754048 commit 263e640

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/typescript-compile-error.ts

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ export class TypeScriptCompileError extends Error {
22
constructor(message: string) {
33
super(message);
44
this.name = this.constructor.name;
5+
6+
// https://github.com/Microsoft/TypeScript-wiki/blob/main/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work
7+
Object.setPrototypeOf(this, new.target.prototype);
58
}
69

710
public static fromError(error: Error): TypeScriptCompileError {

0 commit comments

Comments
 (0)