Suggestion:
tsc currently list the errors. Sometimes you want to see if the number of errors increases or decreases.
Proposition:
$ tsc
FooBar.tsx(66,59): error TS2339: Property 'query' does not exist on type 'Location'.
Hello.tsx(42,60): error TS2339: Property 'query' does not exist on type 'Location'.
dispatcher.ts(1,13): error TS6133: '_' is declared but never used.
World.test.ts(3,35): error TS7006: Parameter 'reason' implicitly has an 'any' type.
World.test.ts(3,43): error TS7006: Parameter 'promise' implicitly has an 'any' type.
World.test.ts(18,13): error TS6133: 'hello' is declared but never used.
mock.ts(194,23): error TS6133: 'ruleId' is declared but never used.
mock.ts(221,8): error TS2339: Property 'fetch' does not exist on type 'Window'.
Compilation done in 2.6s - 8 errors
$ tsc
[...]
Compilation aborted [...]
Could be the opportunity to display other informations (compilation time for example) given that it fits in a single line (72 columns).
(I'm not talking about --diagnostics)
PRs welcomed
Make sure you test this with the MSBuild tasks before merging any PR.
No, please! This would actually make the compiler harder to use from command line scripts. The other major compilers don't work this way either.
Edit: maybe it is appropriate for --pretty, but I think the clean and easily parsable default output should stay unchanged.
@gcnew do you have an example for a tool that would be adversely impacted by this change?
Wouldn't MSBuild be a tool impacted by this change?
Wouldn't MSBuild be a tool impacted by this change?
I do not think so. the way MSBuild does parsing is to looks for specific output pattern for errors , i.e.
<Error Code> <fileName> (<line>,<character>): <Error message>. anything else that does not match this pattern is ignored.
I've parsed the error messages for specific errors and taken custom actions upon them. Admittedly, I used regular expressions as well, however, I think the point still stands. It's good for the compiler to emit uniform output that is easily pipeable to other command line utilities. Please keep it in the unix tradition 😄
I just checked and some of the other major compilers (clang, javac) are emitting statistics as well. With pain in my heart, disregard my remarks.
I have just opened a pull request to implement this: https://github.com/Microsoft/TypeScript/pull/28196
I see that https://github.com/microsoft/TypeScript/pull/28300 added a summary but only with the --pretty option. This was surprising to me.
I would like to pipe my output to a log file but still get a summary of errors at the bottom. I don't want color formatting in my log file. It would be nice if there was a new option for this, independent of --pretty.