"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const path_1 = require("path");
const typescript_1 = require("typescript");
function diagnosticsToString(diagnostics, basePath) {
    return diagnostics.map(x => diagnosticToString(x, basePath)).join(`\n`);
}
exports.diagnosticsToString = diagnosticsToString;
function diagnosticToString(diagnostic, basePath) {
    if (diagnostic.file) {
        const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
        const message = typescript_1.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
        return (`${path_1.join(basePath, diagnostic.file.fileName)} (${line + 1},${character + 1}):` +
            `\n  ${message}`);
    }
    return `${typescript_1.flattenDiagnosticMessageText(diagnostic.messageText, '\n')}`;
}
exports.diagnosticToString = diagnosticToString;
//# sourceMappingURL=diagnosticToString.js.map