Skip to content

Commit b044e71

Browse files
fix: allow to specify pretty errors in TTY (#1420)
* fix: allow to specify pretty errors in TTY closes #1418 * lint fix Co-authored-by: Andrew Bradley <[email protected]>
1 parent 9c1c9ce commit b044e71

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Diff for: src/index.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -675,10 +675,12 @@ export function create(rawOptions: CreateOptions = {}): Service {
675675
},
676676
});
677677

678-
const formatDiagnostics =
679-
process.stdout.isTTY || options.pretty
680-
? ts.formatDiagnosticsWithColorAndContext || ts.formatDiagnostics
681-
: ts.formatDiagnostics;
678+
const shouldHavePrettyErrors =
679+
options.pretty === undefined ? process.stdout.isTTY : options.pretty;
680+
681+
const formatDiagnostics = shouldHavePrettyErrors
682+
? ts.formatDiagnosticsWithColorAndContext || ts.formatDiagnostics
683+
: ts.formatDiagnostics;
682684

683685
function createTSError(diagnostics: ReadonlyArray<_ts.Diagnostic>) {
684686
const diagnosticText = formatDiagnostics(diagnostics, diagnosticHost);

0 commit comments

Comments
 (0)