Error output from tsc.exe is inconsistent


I am making an msbuild task that drives tsc and I am capturing the output and attempting to provide accurate file, line, column and message information to msbuild. However as I am trying to do this I am seeing that error message formats can come in multiple forms. The trick is that if I have to parse these error messages the actual message body should probably come last, since it can contain any character, whereas the file can only have certain characters and the ( , ) surrounding and splitting the line/col are easy to parse.

I am seeing:
[message] [file] ([line], [col]) : [message2]
[file] ([line], [col]) [message]

And possibly more.

  • create a simple class in a file somewhere
  • temporarily delete lib.d.ts from your path (should probably copy it somewhere first)
  • tsc.exe simpleClass.ts
errors to occur, all with this format: [file] ([col], [line]) [message]

mixed error message formats.

file attachments

Closed Jan 29, 2013 at 1:17 AM by RyanCavanaugh
Please reopen if you're still seeing this in Thanks!


justinc wrote Oct 10, 2012 at 4:59 PM

Actually what would be even nicer is if there was a flag for structured error output. Such as, say JSON output. Maybe like:
{ severity : 0,
file: C:/.../file.ts,
line: 10,
column: 16,
message: "something is wrong."

yason wrote Jan 16, 2013 at 10:52 PM

Could you give a more specific repro sequence (including an input file)? I tried this by compiling tsc.ts with the --nolib flag. All the errors seem to be in the standard form.

I have attached the list of errors I got, so you can try it and compare.

justinc wrote Jan 17, 2013 at 4:41 AM

ok I will try. It's been a while since this was opened and there have been some fixes since then. It could be obsolete.