chore(types): tighten types and replace TFile/TFolder casts (W1/9)#2403
Merged
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f425da2121
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
f425da2 to
5b61d52
Compare
Second of nine workspaces splitting #2397. This PR is the TypeScript-only foundation: no runtime behavior changes. - Replace ~395 `any` annotations with specific types across LLM providers, chain runners, components, settings - Replace `as TFile` / `as TFolder` casts with `instanceof` narrowing in source files; tests use new `mockTFile` / `mockTFolder` helpers - Remove ~44 unnecessary type assertions - Fix ~48 non-shared enum comparisons - Remove `any` overrides in union types - Add `src/__tests__/mockObsidian.ts` test helper - `__mocks__/obsidian.js` re-exports real `moment` No source-level runtime changes. `npm run lint`, `npm run build`, and `npm test` (107 suites, 1962 tests) all pass. Builds on top of #2398 (W0 - deps bump). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
5b61d52 to
5b066f5
Compare
W1 should be types-only; this swap from `activeLeaf` to `getMostRecentLeaf()` was a runtime behavior change snuck in. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 12, 2026
Merged
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
Second of nine workspaces splitting #2397 (the 906-warning Obsidian scorecard fix). This PR is the TypeScript-only foundation: no runtime behavior changes.
anyannotations with specific types across LLM providers, chain runners, components, settingsas TFile/as TFoldercasts withinstanceofnarrowing in source files; tests use newmockTFile/mockTFolderhelpers fromsrc/__tests__/mockObsidian.tsprovidertoChatModelProvidersbefore comparing)anyoverrides in union types__mocks__/obsidian.jsre-exports realmomentso test code stays type-safeBuilds on top of #2398 (W0 - deps bump). The remaining workspaces (W2-W9) will land progressively:
window.setTimeout,globalThis→window,atob/btoa→Buffer.fromdocument→activeDocument/ownerDocument+ popout listener fixeselement.style.*→ Tailwind classes_getType→getType)vault.delete→FileManager.trashFile+ Projects App refactoreslint-plugin-obsidianmdTest plan
npm run lintnpm run build(tsc + esbuild)npm test(107 suites, 1962 tests pass)🤖 Generated with Claude Code