diff --git a/src/typescript.ts b/src/typescript.ts index fd60a798..783277ff 100644 --- a/src/typescript.ts +++ b/src/typescript.ts @@ -81,10 +81,11 @@ export async function run(fileNames: string[], options: ts.CompilerOptions): Pro allDiagnostics.forEach(diagnostic => { if (!diagnostic.file) { console.log(diagnostic) + } else { + const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start) + const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n') + console.log(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`) } - const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start) - const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n') - console.log(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`) }) if (emitResult.emitSkipped) { @@ -169,4 +170,4 @@ export function getTypescriptCompileFiles( return configParseResult.fileNames.map(f => f.replace(cwd + '/', '')) } return [] -} \ No newline at end of file +}