How to colorize errors in tsc-output?

When developing a typescript project, I run the compiler in view mode:

tsc --watch

However, when an error occurs, it is difficult for me to recognize the output, since I have simple formatted text:

error output of tsc: <code> src / core / SnowWhite / Cruise / SnowWhiteCruiseClient.ts (10,52): error TS2304: Cannot find name 'favfav'. </code>

Often I don’t even read it, as there are several exits from previous runs.

I am currently trying to alleviate my pain by using grepping for errors to mark this line in red:

tsc -w | egrep --color '.*error.*|$'

feels hacked for now. Is there an easier way to get errors printed beautifully in typescript?

+4
source share
1 answer

TypeScript supports several compiler options , and one of them is pretty:

.

, false, .tsconfig:

{
    "compilerOptions": {
        "pretty": true
    }
}

:

Screenshot of tsc with pretty enabled to provide colors and more context on errors

+6

Source: https://habr.com/ru/post/1664169/


All Articles