-
-
Notifications
You must be signed in to change notification settings - Fork 185
Expand file tree
/
Copy pathreport.ts
More file actions
9 lines (7 loc) · 459 Bytes
/
report.ts
File metadata and controls
9 lines (7 loc) · 459 Bytes
1
2
3
4
5
6
7
8
9
import * as ts from "typescript";
export const prepareDiagnosticForFormatting = (diagnostic: ts.Diagnostic) =>
diagnostic.source === "typescript-to-lua" ? { ...diagnostic, code: "TL" as any } : diagnostic;
export function createDiagnosticReporter(pretty: boolean, system = ts.sys): ts.DiagnosticReporter {
const reporter = ts.createDiagnosticReporter(system, pretty);
return diagnostic => reporter(prepareDiagnosticForFormatting(diagnostic));
}