Skip to content

Commit

Permalink
perf(plugin_kit): improve typescript diagnostics output
Browse files Browse the repository at this point in the history
  • Loading branch information
qwqcode committed Aug 31, 2024
1 parent 6485410 commit f20454b
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions ui/plugin-kit/src/plugin/dts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ export function generateDts(
}

const program = ts.createProgram(fileNames, options, host)
const diagnostics = program.getDeclarationDiagnostics()
if (diagnostics.length) {
logger.error('TypeScript declaration diagnostics:')
diagnostics.forEach((diagnostic) => {
logger.error(ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n'))
})
const diagnostics = [
...program.getDeclarationDiagnostics(),
...program.getSemanticDiagnostics(),
...program.getSyntacticDiagnostics()
]

if (diagnostics?.length) {
logger.error(ts.formatDiagnosticsWithColorAndContext(diagnostics, host))
process.exit(1)
}

Expand Down

0 comments on commit f20454b

Please sign in to comment.