build: enable noImplicitOverride + exactOptionalPropertyTypes - #271
Conversation
Enable two additional strict TypeScript compiler options: - noImplicitOverride: free (0 errors) — prevents accidental method overrides in subclasses without the `override` keyword. - exactOptionalPropertyTypes: distinguishes between "key absent" and "key present with value undefined" — catches a class of bugs where undefined is accidentally passed to an optional parameter. All 26 exactOptionalPropertyTypes errors came from one pattern: Zod's .optional() produces `T | undefined`, but data-layer functions declared optional params as `key?: T` (absent-or-T, not undefined). Fixed by widening the data-layer param types to `key?: T | undefined` — these functions already handle undefined identically to absent, so the widening is correct. No runtime changes, no call-site changes. One SDK type mismatch (StreamableHTTPServerTransport.onclose declared optional but Transport requires it) suppressed with @ts-expect-error until the MCP SDK fixes the type. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
aliasunder has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨ |
|
@CodeRabbit review |
✅ Action performedReview finished.
|
📝 WalkthroughWalkthroughThis PR enables ChangesTypeScript Strictness and Optional Type Annotations
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/vault-mcp/mcp-core/mcp-router.ts (1)
126-129: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueSuppression matches the documented SDK type mismatch.
Confirmed against the SDK source:
oncloseis declared asonclose?: () => voidonStreamableHTTPServerTransport, which is narrower thanTransport's requiredonclose, so the@ts-expect-errorhere is legitimate and well-documented. Worth linking/filing an upstream issue reference in the comment so the suppression is easy to find and remove once the SDK type is fixed.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/vault-mcp/mcp-core/mcp-router.ts` around lines 126 - 129, Keep the existing `@ts-expect-error` suppression around server.connect(transport), but update the nearby comment to include a clear upstream SDK issue/reference for the StreamableHTTPServerTransport onclose type mismatch. Use the existing symbols StreamableHTTPServerTransport, Transport, and server.connect to make it easy to find and remove once the SDK is fixed.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/vault-mcp/mcp-core/mcp-router.ts`:
- Around line 126-129: Keep the existing `@ts-expect-error` suppression around
server.connect(transport), but update the nearby comment to include a clear
upstream SDK issue/reference for the StreamableHTTPServerTransport onclose type
mismatch. Use the existing symbols StreamableHTTPServerTransport, Transport, and
server.connect to make it easy to find and remove once the SDK is fixed.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 73592397-2977-4da1-8d6c-cafa76fe5b62
📒 Files selected for processing (8)
src/vault-mcp/mcp-core/mcp-router.tssrc/vault-mcp/search/search-index.tssrc/vault-mcp/search/search-queries.tssrc/vault-mcp/vault-operations/daily-notes.tssrc/vault-mcp/vault-operations/memory-store.tssrc/vault-mcp/vault-operations/vault-filesystem.tssrc/vault-mcp/vault-operations/vault-patcher.tstsconfig.json
…tyTypes consistency Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Constant was recreated on every listTasks call; its peer constants (DATE_CASCADE, TASK_ORDER_BY) are already at module scope. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Worktree had prettier 3.8.5 cached; CI runs 3.9.4 from the lockfile. Reformatted with the correct version. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
noImplicitOverride(0 existing violations — free safety net for subclass overrides)exactOptionalPropertyTypes(26 violations fixed — distinguishes "key absent" from "key present with valueundefined").optional()producesT | undefined, but data-layer functions declared optional params askey?: T. Fixed by widening tokey?: T | undefined— a type-only change, no runtime behavior change@ts-expect-errorfor an MCP SDK type mismatch (StreamableHTTPServerTransport.onclosedeclared optional butTransportrequires it)Test plan
tsc --noEmitpasses clean🤖 Generated with Claude Code
Summary by Sourcery
Tighten TypeScript type safety by enabling stricter compiler options and aligning search and vault operation parameter types with exact optional semantics.
Enhancements:
Build:
Summary by CodeRabbit