Skip to content

QA-01: typecheck React components with real React 19 types - #189

Merged
anantham merged 2 commits into
mainfrom
claude/pensive-volta-5nyx9k
Sep 25, 2026
Merged

anantham merged 2 commits into
mainfrom
claude/pensive-volta-5nyx9k

Conversation

@anantham

Copy link
Copy Markdown
Owner

Resolves QA-01 in Issues.md. React 19 was installed without @types/react/@types/react-dom, so JSX accepted any props and a green tsc said nothing about component usage.

Changes

  • Adds @types/react 19.1.17 and @types/react-dom 19.1.11, matching the installed React 19.1.
  • Baseline: 54 errors (37 in components/hooks, 17 in tests). All are fixed; nothing is suppressed and there are no placeholder declarations:
    • Refs: React 19 types useRef(null) as RefObject<T | null>. Reader props and hooks now declare that. No unguarded .current use surfaced.
    • Selection feedback: five files declared five different shapes for the same callback. They now share one SelectionFeedback type. FeedbackItem.type also includes ❤️/😂, which the mobile sheet already emits and the store already saves as generic "suggestion" feedback, so behavior is unchanged.
    • Chapter type: ReaderView/ReaderBody read chapter.id, so they now take EnhancedChapter, which is what ChapterView passes.
    • Dead props: TranslationStatusPanel loses onRetranslateClick and three other props left over from before the retranslate button moved to ChapterHeader, plus two unused computations.
    • Small fixes: null vs undefined, event types, NovelMetadata['publicationStatus'] (drops an as any), a local duplicate of ParameterSupportState, and the leaderboard selfJudge field the generator already writes.

Real defects fixed

  • Publish wizard: "Existing Book Found" rendered entry.author, which doesn't exist; the author is entry.metadata.author. The dialog always showed "by " with no name.
  • Sutta Studio: the "Cycle dots" setting was ignored because EnglishWordEngine never accepted showCycleDots. tests/components/sutta-studio/EnglishWord.cycleDots.test.tsx covers it and fails without the fix.

Guard

tests/types/jsx-props.typecheck.tsx holds two intentionally invalid <Loader> usages under @ts-expect-error. With the React types hidden, tsc fails on both lines; this was verified by mutation.

Verification (Node 22 container)

  • tsc: 0 errors
  • eslint: 0 errors
  • vitest run: 9,597 passed, 1 failed. The failure is the known Node-22-only indrasNetImageProvider.test.ts case.
  • The cycle-dots test was checked by mutation.

Not changed (open questions for the owner, recorded under QA-01)

  • Mobile selection offers ❤️/😂; desktop offers 👍/👎/?.
  • The "settings changed since this translation" highlight disappeared when the retranslate button moved to ChapterHeader.

🤖 Generated with Claude Code

https://claude.ai/code/session_011d1MbSabs9nA9d9w8pxP1W


Generated by Claude Code

Adds @types/react 19.1.17 and @types/react-dom 19.1.11 (QA-01). Without them
JSX accepted any props, so tsc passed while components were called wrongly.
The 54 errors they exposed are fixed without suppressions:

- React 19 ref types: RefObject<T | null> in reader props and hooks.
- One SelectionFeedback type for the selection -> feedback callback chain;
  FeedbackItem.type now includes the mobile ❤️/😂 reactions it already stores.
- Reader components take EnhancedChapter (they read chapter.id).
- TranslationStatusPanel loses retranslate props left over from before the
  button moved to ChapterHeader.

Real defects fixed on the way: PublishWizard's 'Existing Book Found' dialog
read entry.author (always empty; it lives at entry.metadata.author), and
Sutta Studio's 'cycle dots' setting was ignored (regression test added).
tests/types/jsx-props.typecheck.tsx fails tsc if prop checking disappears.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011d1MbSabs9nA9d9w8pxP1W
@vercel

vercel Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
lexicon-forge Ready Ready Preview Sep 25, 2026 7:07am UTC

Review of #189: the fixture was cast 'as unknown as PaliWord[]' and its
senses lacked the required nuance field, bypassing the type check this PR
restores. It is now a complete PaliWord[] literal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011d1MbSabs9nA9d9w8pxP1W
@anantham
anantham merged commit be6257e into main Sep 25, 2026
8 checks passed

This branch was successfully deployed

1 active deployment
Preview — 539df0e3 Deployed Sep 25, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants