Repository navigation
fix(tsgo): keep declarations for files outside the tsconfig dir in the temp outDir - #313
Conversation
|
We hit the same problem in a pnpm monorepo and this fix solves it. Our setup: a published package ( With the current I tested this PR locally by applying the one-line change to the installed plugin (rolldown-plugin-dts 0.28.6, tsdown 0.23.0, TypeScript 7.0.2). With a tsconfig inside the package that includes the other sources, the build succeeds. Thanks for the fix, would be awesome to see this merged! edit: some more details. |
a5c6ff1 to
9bc9ae9
Compare
…e temp outDir tsgo was run with --rootDir set to the tsconfig directory. Files the program pulls in from outside it, such as workspace packages that resolve to their sources, are not under rootDir, so tsgo wrote their .d.ts next to the source files instead of into the temp outDir. Use the filesystem root as rootDir so every emitted declaration lands in the temp dir.
276aaf3 to
008f261
Compare
|
Thank you for contributing! This PR does not follow the required PR template. Missing: the template instruction comment, the "AI usage" section, the "Description" section, the "Linked Issues" section, the "Additional context" section. Please use the shared PR template, preserve its comments and sections, and complete the applicable fields, including the AI usage disclosure. This PR is being closed automatically. After updating the description, you can reopen it or ask a maintainer to reopen it. |
|
@sxzz I updated the description to follow the PR template. Could you reopen this PR? I can't reopen it myself. |
commit: |
AI usage
Description
In a source-first monorepo, a package often pulls another workspace package's TypeScript sources into its program, through tsconfig
pathsor a relative import. The deprecated TypeScript 7.0 tsgo CLI backend runs tsgo with--rootDirset to the tsconfig directory, so declarations for those outside files are written next to their sources instead of into the temp outDir. Building one package quietly creates.d.tsfiles in other packages'src, and fails with TS5033 when those directories aren't writable.This passes the filesystem root as
--rootDir, so every declaration tsgo emits lands in the temp directory.Linked Issues
Additional context
The new test runs the CLI backend with the real tsgo binary. It fails without this change.