fix: typecheck the contract test file (#6) - #7
Merged
Conversation
tsconfig.json excludes **/*.test.ts so `tsc --noEmit` only checked schemas.ts, never schemas.test.ts — the repo's entire deliverable. A type-level drift in how the test consumes the schemas (the exact failure this repo exists to surface) passed the typecheck gate clean. Add tsconfig.test.json (extends base, noEmit, declaration off, re-includes test files) and run it as a second step in the `typecheck` script. `build` still uses tsconfig.json, so dist/ contains only schemas.js/.d.ts — no test declarations emitted. Verified: a deliberate type error in schemas.test.ts now fails `npm run typecheck`, and the full sequence (typecheck/test/build) is green. Fixes #6 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tsconfig.jsonexcluded**/*.test.ts, sotsc --noEmitonly ever checkedschemas.ts— neverschemas.test.ts, which is the repo's entire deliverable (the upstream-schema-drift contract test). A type error in the test (bad import after a schema rename, mismatchedsafeParsearg, etc.) passed thetypecheckgate clean.Change
tsconfig.test.jsonextending the base withnoEmit+declaration: false, re-including test files.typecheckscript now runstsc --noEmit && tsc -p tsconfig.test.json.buildstill usestsconfig.json, sodist/emits onlyschemas.js/schemas.d.ts— no test declarations leak into the build.Verification
const x: number = "..."intoschemas.test.tsnow failsnpm run typecheck(error TS2322).dist/unchanged.Fixes #6
🤖 Generated with Claude Code