MCPcopy Index your code
hub / github.com/nodejs/node / convertToDiagnostics

Function convertToDiagnostics

test/fixtures/snapshot/typescript.js:120168–120189  ·  view source on GitHub ↗
(diagnostics, newProgram, getCanonicalFileName)

Source from the content-addressed store, hash-verified

120166 return state;
120167 }
120168 function convertToDiagnostics(diagnostics, newProgram, getCanonicalFileName) {
120169 if (!diagnostics.length)
120170 return ts.emptyArray;
120171 var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(newProgram.getCompilerOptions()), newProgram.getCurrentDirectory()));
120172 return diagnostics.map(function (diagnostic) {
120173 var result = convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPath);
120174 result.reportsUnnecessary = diagnostic.reportsUnnecessary;
120175 result.reportsDeprecated = diagnostic.reportDeprecated;
120176 result.source = diagnostic.source;
120177 result.skippedOn = diagnostic.skippedOn;
120178 var relatedInformation = diagnostic.relatedInformation;
120179 result.relatedInformation = relatedInformation ?
120180 relatedInformation.length ?
120181 relatedInformation.map(function (r) { return convertToDiagnosticRelatedInformation(r, newProgram, toPath); }) :
120182 [] :
120183 undefined;
120184 return result;
120185 });
120186 function toPath(path) {
120187 return ts.toPath(path, buildInfoDirectory, getCanonicalFileName);
120188 }
120189 }
120190 function convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPath) {
120191 var file = diagnostic.file;
120192 return __assign(__assign({}, diagnostic), { file: file ? newProgram.getSourceFileByPath(toPath(file)) : undefined });

Callers 1

Calls 2

mapMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…