From 88fb2b2ce83b7f2e8066c8e9abf13afdf76927fc Mon Sep 17 00:00:00 2001 From: ElevateBart Date: Thu, 5 Aug 2021 09:27:37 -0500 Subject: [PATCH] fix: allow to specify pretty errors in TTY closes #1418 --- src/index.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 5360a86a0..3dbc92d05 100644 --- a/src/index.ts +++ b/src/index.ts @@ -625,8 +625,13 @@ export function create(rawOptions: CreateOptions = {}): Service { }, }); - const formatDiagnostics = - process.stdout.isTTY || options.pretty + const shouldHavePrettyErrors = + options.pretty === undefined + ? process.stdout.isTTY + : options.pretty + + const formatDiagnostics = + shouldHavePrettyErrors ? ts.formatDiagnosticsWithColorAndContext || ts.formatDiagnostics : ts.formatDiagnostics;