Skip to content

Configure TypeScript typecheck for type-drift detection#596

Merged
sroussey merged 1 commit into
mainfrom
claude/eloquent-turing-y6k527
Jun 23, 2026
Merged

Configure TypeScript typecheck for type-drift detection#596
sroussey merged 1 commit into
mainfrom
claude/eloquent-turing-y6k527

Conversation

@sroussey

Copy link
Copy Markdown
Collaborator

Summary

Adds TypeScript typecheck configuration for Vitest to enable type-drift detection in .test-d.ts files. This isolates the type-checking scope to the packages/ai package to prevent unrelated source code (example UIs, provider ambient types) from being swept into type-checking reports.

Changes

  • tsconfig.typecheck.json (new): Dedicated TypeScript configuration that extends the base config with noEmit: true and scopes type-checking to packages/ai/src/**/*
  • vitest.config.ts: Added typecheck configuration block that references the new tsconfig.typecheck.json, with explanatory comment about the nightly type-drift guard and why the scope is limited to the package under test

Implementation Details

The typecheck configuration disables composite and incremental compilation modes while enabling noEmit to ensure Vitest's --typecheck engine only validates types without generating output. By explicitly including only packages/ai/src/**/* and excluding dist and node_modules, the configuration prevents type-checking from inadvertently reporting drift in unrelated packages that may have their own type requirements (e.g., JSX in example UIs, ambient type declarations in provider packages).

https://claude.ai/code/session_01G6ie5uJvfMpFZrGtrKL1c4

Vitest's `--typecheck` engine built its tsc program from the root
`tsconfig.json`, which has no `include` and therefore swept the entire
monorepo's source. Example UI `.tsx` files (which need `jsx`) and provider
packages relying on their own ambient `types`/`lib` (Chrome AI, Cloudflare)
then surfaced hundreds of "unhandled source errors" unrelated to the drift
guard, failing the nightly even though the 3 drift tests passed.

Point vitest's typecheck at a dedicated `tsconfig.typecheck.json` scoped to
`packages/ai/src`, so the program only contains the file under test and
resolves cross-package imports to the already-built `.d.ts` declarations.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G6ie5uJvfMpFZrGtrKL1c4
@sroussey sroussey merged commit 0181813 into main Jun 23, 2026
9 of 12 checks passed
@sroussey sroussey deleted the claude/eloquent-turing-y6k527 branch June 23, 2026 20:22
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.

2 participants