Skip to content

Commit

Permalink
When check generated bundles, do not compile them together as they mi…
Browse files Browse the repository at this point in the history
…ght have incompatible global declarations

Fixes #296
  • Loading branch information
timocov committed Jan 27, 2024
1 parent 03fd032 commit 43c2058
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/bin/dts-bundle-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,20 @@ function main(): void {
warnLog('Compiler option "skipLibCheck" is disabled to properly check generated output');
}

const program = ts.createProgram(outFilesToCheck, compilerOptions);
checkProgramDiagnosticsErrors(program);
let checkFailed = false;
for (const outputFile of outFilesToCheck) {
const program = ts.createProgram([outputFile], compilerOptions);

try {
checkProgramDiagnosticsErrors(program);
} catch (e) {
checkFailed = true;
}
}

if (checkFailed) {
throw new Error('Failed to check some of generated bundles, check error messages above');
}
}

try {
Expand Down

0 comments on commit 43c2058

Please sign in to comment.