Skip to content

chore: fix all tsc errors in tests and gate CI on typecheck#34

Merged
jonlaing merged 2 commits into
mainfrom
chore/typecheck-tests
Jul 12, 2026
Merged

chore: fix all tsc errors in tests and gate CI on typecheck#34
jonlaing merged 2 commits into
mainfrom
chore/typecheck-tests

Conversation

@jonlaing

Copy link
Copy Markdown
Owner

Summary

578 → 0 tsc errors across 27 test files. Adds pnpm typecheck to the CI job so future regressions block PRs.

Breakdown

Cause Errors fixed Fix
Missing .js extensions on relative imports ~470 Swept via script; directory imports (e.g. ./Element) got /index.js, file imports got .js. When TS can't resolve a path under nodenext, it binds exports to fallback types, which cascades into Effect's generic inference (turning R into unknown), spawning hundreds of downstream TS2345s. Fixing the imports fixed everything downstream.
renderToString return-type inference ~18 Signature used Deps | R which TS can't do type subtraction from. Switched to Exclude<R, Deps> so provided tags (RendererContext, ControlCtx, SuspenseBoundaryCtx, Scope) no longer leak into the returned Effect's requirements. Real bug — any user rendering an App that uses Signal.make (which requires Scope) hit this. Runtime unchanged.
Route.test.ts type asserts ~10 A handful of tests use Effect.succeed(data) as a stand-in render fn to exercise loader→render type flow. That doesn't satisfy the HTMLElement | SVGElement return constraint. Cast to never; the tests exercise behaviour, not the constraint.
Unused variables and misc ~6 Prefixed with _.

Verify

  • npx tsc --noEmit → 0 errors
  • pnpm exec vitest run → 718 pass / 2 skipped (unchanged)
  • pnpm build → clean
  • CI workflow updated to run pnpm typecheck before build / test

Notes

Nothing in packages/*/src (non-test) source code was silently broken by this — the library's build had always been clean because tsup only sees production entry points, not test files. This PR just closes the "typecheck can silently regress" loophole.

🤖 Generated with Claude Code

578 -> 0 tsc errors across 27 test files. Breakdown:

1. Missing .js extensions on relative imports (~470 errors). TS's nodenext moduleResolution requires them; when it can't resolve a path it binds the exports to fallback types, which then cascades into Effect's generic inference and makes R = unknown, spawning hundreds of downstream TS2345 errors. Swept all test files to add extensions (and /index.js for directory imports).

2. renderToString return-type inference (18 errors). The signature used 'Deps | R' which TypeScript can't subtract from, leaking Scope/RendererContext/ControlCtx/SuspenseBoundaryCtx into the returned Effect's requirements. Switched to 'Exclude<R, Deps>' so tests that pass Elements with Scope in R (any App that uses Signal.make) now type-check cleanly. Runtime behaviour unchanged.

3. Route.test.ts type asserts (~10 errors). A handful of tests exercise loader→render type flow using Effect.succeed(data) as a stand-in render fn, which doesn't satisfy the HTMLElement | SVGElement return constraint. Cast to never — the tests exercise behaviour, not the constraint.

4. Unused variables and misc fixes (~6 errors). Prefixed with _.

CI: added 'pnpm typecheck' step so future regressions block PRs.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 12, 2026

Copy link
Copy Markdown

Deploying effex-api with  Cloudflare Pages  Cloudflare Pages

Latest commit: b8e11d2
Status: ✅  Deploy successful!
Preview URL: https://21113813.effex-api.pages.dev
Branch Preview URL: https://chore-typecheck-tests.effex-api.pages.dev

View logs

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 12, 2026

Copy link
Copy Markdown

Deploying effex with  Cloudflare Pages  Cloudflare Pages

Latest commit: b8e11d2
Status: ✅  Deploy successful!
Preview URL: https://a7a4a026.effex.pages.dev
Branch Preview URL: https://chore-typecheck-tests.effex.pages.dev

View logs

@effex/dom exports ./client, ./server, and ./hydrate as subpaths. Root tsconfig only had a path for @effex/dom itself, so consumers (currently @effex/platform importing @effex/dom/server) resolved subpaths via the exports map in dom's package.json — which points at ./dist. Locally that worked because dist existed from earlier builds; in CI, pnpm typecheck runs before pnpm build, so the subpaths were unresolvable.

Map each subpath to its source entry so typecheck stays independent of build state.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@jonlaing
jonlaing merged commit 392ef64 into main Jul 12, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant