Skip to content

build: enable noImplicitOverride + exactOptionalPropertyTypes - #271

Merged
aliasunder merged 4 commits into
mainfrom
worktree-tsconfig-strict
Jul 6, 2026
Merged

build: enable noImplicitOverride + exactOptionalPropertyTypes#271
aliasunder merged 4 commits into
mainfrom
worktree-tsconfig-strict

Conversation

@aliasunder

@aliasunder aliasunder commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Summary

  • Enable noImplicitOverride (0 existing violations — free safety net for subclass overrides)
  • Enable exactOptionalPropertyTypes (26 violations fixed — distinguishes "key absent" from "key present with value undefined")
  • All 26 errors came from one pattern: Zod's .optional() produces T | undefined, but data-layer functions declared optional params as key?: T. Fixed by widening to key?: T | undefined — a type-only change, no runtime behavior change
  • One @ts-expect-error for an MCP SDK type mismatch (StreamableHTTPServerTransport.onclose declared optional but Transport requires it)

Test plan

  • tsc --noEmit passes clean
  • All 1484 tests pass
  • Lint clean (0 errors)

🤖 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:

  • Update search filter and vault operation parameter types to treat optional values as potentially undefined without changing runtime behavior.
  • Adjust various type definitions and unions for improved clarity and compatibility with stricter TypeScript settings.
  • Annotate MCP router transport connection with a ts-expect-error to document and accommodate an upstream SDK type inconsistency.

Build:

  • Enable noImplicitOverride and exactOptionalPropertyTypes in tsconfig to enforce safer subclassing and precise optional property behavior.

Summary by CodeRabbit

  • Chores
    • Tightened TypeScript checking across the project for more consistent optional-field handling.
    • Updated several public search, note, and vault operation inputs to accept omitted values more reliably.
    • Added a type-safety note for an existing transport setup issue without changing behavior.
    • No runtime functionality was changed.

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>

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aliasunder has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

PR Code Suggestions ✨

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread src/vault-mcp/search/search-queries.ts
@aliasunder

Copy link
Copy Markdown
Owner Author

@CodeRabbit review

@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR enables noImplicitOverride and exactOptionalPropertyTypes in tsconfig.json, then updates optional parameter types across search and vault-operations modules to explicitly include | undefined unions for compatibility. Also adds @ts-expect-error comments for an SDK type mismatch in mcp-router.ts. No runtime logic changes.

Changes

TypeScript Strictness and Optional Type Annotations

Layer / File(s) Summary
Compiler strictness flags
tsconfig.json
Adds noImplicitOverride and exactOptionalPropertyTypes compiler options.
Search module type annotations
src/vault-mcp/search/search-index.ts, src/vault-mcp/search/search-queries.ts
SearchFilters, TaskDateFilter, TaskStatusFilter, TaskSortKey, and function parameter types (fullTextSearch, hybridSearch, searchByTag, searchByFolder, listTasks, recentNotes, listPropertyKeys, listPropertyValues, searchByProperty, findOrphans) now explicitly annotate optional fields as `...
Vault-operations type annotations
src/vault-mcp/vault-operations/daily-notes.ts, .../memory-store.ts, .../vault-filesystem.ts, .../vault-patcher.ts
Optional parameters in getDailyNote, getMemory, updateMemory, readNoteSection, writeNote, listNotes, patchNote, replaceInNote, and deleteSpan explicitly include `
MCP router type suppression
src/vault-mcp/mcp-core/mcp-router.ts
Adds @ts-expect-error comments documenting an SDK type mismatch on StreamableHTTPServerTransport's onclose.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: enabling the two TypeScript compiler strictness flags.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch worktree-tsconfig-strict

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/vault-mcp/mcp-core/mcp-router.ts (1)

126-129: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Suppression matches the documented SDK type mismatch.

Confirmed against the SDK source: onclose is declared as onclose?: () => void on StreamableHTTPServerTransport, which is narrower than Transport's required onclose, so the @ts-expect-error here 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

📥 Commits

Reviewing files that changed from the base of the PR and between df339ce and e3118b2.

📒 Files selected for processing (8)
  • src/vault-mcp/mcp-core/mcp-router.ts
  • src/vault-mcp/search/search-index.ts
  • src/vault-mcp/search/search-queries.ts
  • src/vault-mcp/vault-operations/daily-notes.ts
  • src/vault-mcp/vault-operations/memory-store.ts
  • src/vault-mcp/vault-operations/vault-filesystem.ts
  • src/vault-mcp/vault-operations/vault-patcher.ts
  • tsconfig.json

aliasunder and others added 3 commits July 6, 2026 15:34
…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>
@aliasunder
aliasunder merged commit 44f810b into main Jul 6, 2026
19 of 20 checks passed
@aliasunder
aliasunder deleted the worktree-tsconfig-strict branch July 6, 2026 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant