From 2de3c86b31344e8d3afaaeca73853a25e640ce59 Mon Sep 17 00:00:00 2001 From: Thomas Camlong Date: Thu, 13 Aug 2026 19:07:37 +0200 Subject: [PATCH] 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. --- apps/docs/tsconfig.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/docs/tsconfig.json b/apps/docs/tsconfig.json index 1142ed3fb..0ac6029b0 100644 --- a/apps/docs/tsconfig.json +++ b/apps/docs/tsconfig.json @@ -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"], }