function reportErrorsAndExit(allDiagnostics, options, consoleError) { if (consoleError === void 0) { consoleError = console.error; } var errorsAndWarnings = perform_compile_1.filterErrorsAndWarnings(allDiagnostics); if (errorsAndWarnings.length) { var currentDir_1 = options ? options.basePath : undefined; var formatHost = { getCurrentDirectory: function () { return currentDir_1 || ts.sys.getCurrentDirectory(); }, getCanonicalFileName: function (fileName) { return fileName; }, getNewLine: function () { return ts.sys.newLine; } }; consoleError(perform_compile_1.formatDiagnostics(errorsAndWarnings, formatHost)); } return perform_compile_1.exitCodeFromResult(allDiagnostics); }
return perform_watch_1.performWatchCompilation(perform_watch_1.createPerformWatchHost(project, function (diagnostics) { consoleError(perform_compile_1.formatDiagnostics(diagnostics)); }, options, function (options) { return createEmitCallback(options); }));
function formatDiagnostics(diags) { return perform_compile_1.formatDiagnostics(diags); }