Description
The fix for #220 (adding emitDeclarationOnly: true) was applied in getDeclarationFiles but not in compileDts. This means the second ts.createProgram call in compileDts still hits TS5055 when checkJs: true is enabled.
Reproduction
https://github.com/gtbuchanan/dts-bundle-generator-repro-5055
pnpm install
node repro.js
Expected
entry.ts is bundled successfully.
Actual
error TS5055: Cannot write file 'lib.mjs' because it would overwrite input file.
Analysis
In compile-dts.js, compileDts removes outDir (line 28) and sets declaration: true (line 33), but does not set emitDeclarationOnly: true. It then calls getDeclarationFiles, which creates its own program with emitDeclarationOnly: true (line 136) — that program works fine. But afterwards, compileDts creates a second program (line 79) using the original compilerOptions (without emitDeclarationOnly), and checkProgramDiagnosticsErrors on line 80 reports TS5055.
The fix from #220 / #221 needs to also be applied to the compilerOptions in compileDts, not just in getDeclarationFiles.
Versions
- dts-bundle-generator: 9.5.1
- TypeScript: 5.9.3
Description
The fix for #220 (adding
emitDeclarationOnly: true) was applied ingetDeclarationFilesbut not incompileDts. This means the secondts.createProgramcall incompileDtsstill hits TS5055 whencheckJs: trueis enabled.Reproduction
https://github.com/gtbuchanan/dts-bundle-generator-repro-5055
Expected
entry.tsis bundled successfully.Actual
Analysis
In
compile-dts.js,compileDtsremovesoutDir(line 28) and setsdeclaration: true(line 33), but does not setemitDeclarationOnly: true. It then callsgetDeclarationFiles, which creates its own program withemitDeclarationOnly: true(line 136) — that program works fine. But afterwards,compileDtscreates a second program (line 79) using the originalcompilerOptions(withoutemitDeclarationOnly), andcheckProgramDiagnosticsErrorson line 80 reports TS5055.The fix from #220 / #221 needs to also be applied to the
compilerOptionsincompileDts, not just ingetDeclarationFiles.Versions