chore: fix pre-existing typecheck errors + add CI typecheck gate#13
Merged
Conversation
#10) Resolve all 78 `npx nuxi typecheck` errors so the check can gate CI. - 77 test call-site errors (noUncheckedIndexedAccess, TS2532/TS18048): add `!` at provably-in-range index/destructure sites, matching the convention already used by newer tests. No production source or test assertions changed. - 1 page-component error (TS2322) was a real latent bug: AccountRegister emits a plain numeric index, but pages/accounts/[...path].vue's deleteTx was typed to receive `{ transactionIndex }` and read `.transactionIndex` off the number, sending `index: undefined` on delete. Fix deleteTx/editTx to take `number` (also removes an `any`). - Add .github/workflows/ci.yml: typecheck-only job (npm ci -> nuxi typecheck) on push/PR to main. No test job yet (needs hledger on PATH; overlaps #11). The delete fix is guarded by the typecheck gate itself (reverting the handler reintroduces the same TS2322) rather than a runtime test — the suite has no component-mount harness and deleteTx isn't exported. Verified: nuxi typecheck = 0 errors (was 78); vitest run = 40 files pass. 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.
Fixes #10
Makes
npx nuxi typecheckgenuinely clean (78 → 0 errors) and gates it in CI so it can't regress. Spec'd design-first under.kiro/specs/fix-typecheck-errors/.Two distinct root causes
77 test call-site errors —
noUncheckedIndexedAccess(TS2532/TS18048)Tests index results they construct (so are provably in range) without telling the compiler. Fixed with
!at the index/destructure site — the same convention newer tests already follow. No production source changed; no test assertion weakened, skipped, or deleted.utils/toRegisterRows.test.ts(38)utils/toTransactionInput.test.ts(13)utils/toTransactionInput.property.test.ts(12)utils/roundTrip.property.test.ts(7)utils/toRegisterRows.property.test.ts(6)server/api/__tests__/migration.test.ts(1)1 page-component error — a real latent bug (TS2322)
AccountRegisteremitsdelete: [index: number](a plain number), butpages/accounts/[...path].vue'sdeleteTxwas typed{ transactionIndex: number }and read.transactionIndexoff the number → delete requests sentindex: undefined. FixeddeleteTx/editTxto takenumber(also removes anany). The typecheck flagged a genuine defect, exactly as the issue suspected.CI gate
New
.github/workflows/ci.yml— typecheck-only job (npm ci→npx nuxi typecheck) on push/PR tomain. No test job yet: the suite has hledger-on-PATH-gated tests whose CI wiring overlaps with #11, left to a follow-up.Decisions (both confirmed during the spec)
deleteTxisn't exported; reverting the handler reintroduces the exact TS2322 and fails CI. Seedesign.md/ R3.4.Verification
npx nuxi typecheck→ 0 errors (was 78), exit 0npx vitest run→ 40 test files passci.yml; no tooling config touched (noUncheckedIndexedAccessstays on; no test excluded), no newany🤖 Generated with Claude Code