fix(docs): exclude generated output from the docs typecheck

CI failed @homarr/docs:typecheck with a wall of TS1473 "An import declaration can
only be used at the top level of a module" pointing at
build/__server/assets/js/*.js - Docusaurus's own emitted bundles, not source.

The docs tsconfig includes **/*.js with allowJs enabled and excludes only
node_modules, so anything the build writes into the package is typechecked as
source. The turbo `typecheck` task dependsOn ["^topo"] and not on its own
package's `build`, so `docusaurus build` and `tsc --noEmit` run concurrently -
and tsc can observe the transient build/__server/ directory before the build
removes it again.

That makes it a latent race rather than a deterministic failure, which is why it
has not bitten before: it needs @homarr/docs to be in the affected set, and
merging dev brought apps/docs changes in. Locally it passes either way, because a
completed build leaves no __server directory behind.

Verified against a control rather than assumed: with build/__server/assets/js
containing a nested import declaration, the current tsconfig reports 0 errors and
the same tsconfig without the exclude reports the 2 TS1473 errors, matching CI.
This commit is contained in:
Thomas Camlong committed 2026-08-13 19:08:08 +02:00
1 parent be0043ab81
commit 2de3c86b31
1 file changed
+6 -1
+6 -1
View File
@@ -26,5 +26,10 @@
"**/*.md",
"**/*.mdx",
],
"exclude": ["node_modules"],
// `include` sweeps up **/*.js and allowJs is on, so anything the build emits into this package is
// typechecked as source. The turbo `typecheck` task only dependsOn ["^topo"], not on its own
// package's `build`, so `docusaurus build` and `tsc --noEmit` run concurrently - and tsc can observe
// Docusaurus's transient `build/__server/` bundles and fail with TS1473 before the build removes
// them. Excluding generated output makes typecheck independent of that scheduling.
"exclude": ["node_modules", "build", ".docusaurus"],
}