Skip to content

Commit 43c2058

Browse files
committed
When check generated bundles, do not compile them together as they might have incompatible global declarations
Fixes #296
1 parent 03fd032 commit 43c2058

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/bin/dts-bundle-generator.ts

+14-2
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,20 @@ function main(): void {
261261
warnLog('Compiler option "skipLibCheck" is disabled to properly check generated output');
262262
}
263263

264-
const program = ts.createProgram(outFilesToCheck, compilerOptions);
265-
checkProgramDiagnosticsErrors(program);
264+
let checkFailed = false;
265+
for (const outputFile of outFilesToCheck) {
266+
const program = ts.createProgram([outputFile], compilerOptions);
267+
268+
try {
269+
checkProgramDiagnosticsErrors(program);
270+
} catch (e) {
271+
checkFailed = true;
272+
}
273+
}
274+
275+
if (checkFailed) {
276+
throw new Error('Failed to check some of generated bundles, check error messages above');
277+
}
266278
}
267279

268280
try {

0 commit comments

Comments
 (0)