From 9790ef20b4567693f9581937a252d7277b43eeae Mon Sep 17 00:00:00 2001 From: Andrew Bradley Date: Sun, 6 Feb 2022 21:30:59 -0500 Subject: [PATCH 1/2] Make tserror diagnosticText non-enumerable to prevent it from logging below stack trace in errors --- src/index.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 5b7cffc2d..bad2e1df1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -462,9 +462,15 @@ export const DEFAULTS: RegisterOptions = { */ export class TSError extends BaseError { name = 'TSError'; + diagnosticText!: string; - constructor(public diagnosticText: string, public diagnosticCodes: number[]) { + constructor(diagnosticText: string, public diagnosticCodes: number[]) { super(`тип Unable to compile TypeScript:\n${diagnosticText}`); + Object.defineProperty(this, 'diagnosticText', { + configurable: true, + writable: true, + value: diagnosticText + }); } /** From 836d783c4cd8af28ac9abb205cfc43e91c5f34fa Mon Sep 17 00:00:00 2001 From: Andrew Bradley Date: Mon, 7 Feb 2022 01:33:29 -0500 Subject: [PATCH 2/2] lint-fix --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index bad2e1df1..0ffeea3fc 100644 --- a/src/index.ts +++ b/src/index.ts @@ -469,7 +469,7 @@ export class TSError extends BaseError { Object.defineProperty(this, 'diagnosticText', { configurable: true, writable: true, - value: diagnosticText + value: diagnosticText, }); }