QA-01: typecheck React components with real React 19 types - #189
Merged
Merged
Conversation
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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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
This branch was successfully deployed
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.
Resolves QA-01 in
Issues.md. React 19 was installed without@types/react/@types/react-dom, so JSX accepted any props and a greentscsaid nothing about component usage.Changes
@types/react19.1.17 and@types/react-dom19.1.11, matching the installed React 19.1.useRef(null)asRefObject<T | null>. Reader props and hooks now declare that. No unguarded.currentuse surfaced.SelectionFeedbacktype.FeedbackItem.typealso includes ❤️/😂, which the mobile sheet already emits and the store already saves as generic "suggestion" feedback, so behavior is unchanged.ReaderView/ReaderBodyreadchapter.id, so they now takeEnhancedChapter, which is whatChapterViewpasses.TranslationStatusPanellosesonRetranslateClickand three other props left over from before the retranslate button moved toChapterHeader, plus two unused computations.NovelMetadata['publicationStatus'](drops anas any), a local duplicate ofParameterSupportState, and the leaderboardselfJudgefield the generator already writes.Real defects fixed
entry.author, which doesn't exist; the author isentry.metadata.author. The dialog always showed "by " with no name.EnglishWordEnginenever acceptedshowCycleDots.tests/components/sutta-studio/EnglishWord.cycleDots.test.tsxcovers it and fails without the fix.Guard
tests/types/jsx-props.typecheck.tsxholds two intentionally invalid<Loader>usages under@ts-expect-error. With the React types hidden,tscfails on both lines; this was verified by mutation.Verification (Node 22 container)
tsc: 0 errorseslint: 0 errorsvitest run: 9,597 passed, 1 failed. The failure is the known Node-22-onlyindrasNetImageProvider.test.tscase.Not changed (open questions for the owner, recorded under QA-01)
ChapterHeader.🤖 Generated with Claude Code
https://claude.ai/code/session_011d1MbSabs9nA9d9w8pxP1W
Generated by Claude Code