Skip to content

Commit

Permalink
fix: log errors emitting declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Apr 25, 2024
1 parent a0d9423 commit 1fb5a74
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/utils/dts.ts
Expand Up @@ -60,7 +60,10 @@ export async function getDeclarations(
opts.typescript.compilerOptions,
tsHost,
);
await program.emit();
const result = program.emit();
if (result.diagnostics?.length) {
console.error(ts.formatDiagnostics(result.diagnostics, tsHost));
}

return extractDeclarations(vfs, inputFiles, opts);
}
Expand Down
10 changes: 8 additions & 2 deletions src/utils/vue-dts.ts
Expand Up @@ -89,7 +89,10 @@ async function emitVueTscV1(
host: tsHost,
});

program.emit();
const result = program.emit()
if (result.diagnostics?.length) {
console.error(ts.formatDiagnostics(result.diagnostics, tsHost))
}
} finally {
ts.sys.writeFile = _tsSysWriteFile;
ts.sys.readFile = _tsSysReadFile;
Expand Down Expand Up @@ -157,5 +160,8 @@ async function emitVueTscV2(
);

const program = createProgram(programOptions);
program.emit();
const result = program.emit()
if (result.diagnostics?.length) {
console.error(ts.formatDiagnostics(result.diagnostics, tsHost))
}
}

0 comments on commit 1fb5a74

Please sign in to comment.