* Prints the diagnostics to stdout. * @param {ts.Diagnostic[]} diagnostics The diagnostics to report.
(diagnostics)
| 101 | * @param {ts.Diagnostic[]} diagnostics The diagnostics to report. |
| 102 | */ |
| 103 | function printDiagnostics(diagnostics) { |
| 104 | diagnostics.forEach((diagnostic) => { |
| 105 | let message = ''; |
| 106 | |
| 107 | if (diagnostic.file && diagnostic.start) { |
| 108 | let start = diagnostic.file.getLineAndCharacterOfPosition( |
| 109 | diagnostic.start |
| 110 | ); |
| 111 | |
| 112 | message += ` ${diagnostic.file.fileName} (${start.line + 1},${ |
| 113 | start.character + 1 |
| 114 | })`; |
| 115 | } |
| 116 | |
| 117 | message += |
| 118 | ': ' + ts.flattenDiagnosticMessageText(diagnostic.messageText, ' \n'); |
| 119 | |
| 120 | process.stdout.write(`\x1b[30m ${message}\x1b[0m\n`); |
| 121 | }); |
| 122 | } |