fix(web): qualify JSX.Element for React 19 in the design-system types (HT-97) - #111
Merged
Conversation
… (HT-97) Every .d.ts under web/src/components/ds/ declared its return type as the GLOBAL `JSX.Element`. React 19 removed that namespace, and this repo runs react / @types/react ^19.2.4, so those 34 declarations resolved to nothing. CI never caught it because web/tsconfig.json sets skipLibCheck: true, which skips declaration-file checking entirely — the build and typecheck were green over broken types the whole time. Found by CodeRabbit on PR #105. Fixed UPSTREAM FIRST in the Claude Design project, then re-pulled verbatim, per the bidirectional policy in CLAUDE.md — editing these copies directly would have broken the verbatim invariant on 21 files. All 26 upstream .d.ts were fixed (including the five components/app/ screens that live only in the design project); the 21 that mirror into ds/ came back down here. `React.JSX.Element` rather than an added import: these files already use `React.ReactNode` and `React.CSSProperties` off the UMD global without importing React, and those resolve fine — only the bare `JSX` namespace did not. This keeps the house style unchanged. Verified: - tsc --noEmit --types react over ds/**/*.d.ts WITHOUT --skipLibCheck: exit 0, 0 errors (was exit 2, 29 x TS2503 "Cannot find namespace 'JSX'") - the diff contains no line that isn't a JSX.Element qualification - all 21 files byte-identical to the design project after the re-pull - upload read back and compared before re-pulling, since a write_files reporting success is not proof it applied (learned the hard way in HT-94) Gates (each on its own exit code): biome check . = 0, npm run typecheck = 0, npm run build = 0.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (21)
📝 WalkthroughWalkthroughAll listed design-system ChangesReact JSX declaration alignment
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)
Comment |
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.
Closes HT-97. Found by CodeRabbit on #105.
The bug
Every
.d.tsunderweb/src/components/ds/declared its return type as the globalJSX.Element. React 19 removed that namespace, and this repo runsreact/@types/react^19.2.4— so all 34 declarations resolved to nothing.Why CI never caught it:
web/tsconfig.jsonsetsskipLibCheck: true, which skips declaration-file checking altogether. Build and typecheck were green over broken types the entire time. Nothing was breaking at runtime — the cost was that every consumer and editor got no usable return type from the design system's API contract.Fixed upstream first
Per the bidirectional policy in
CLAUDE.md: these files are byte-verbatim copies of the Claude Design project, so editing them here would have broken the verbatim invariant on 21 files. All 26 upstream.d.tswere fixed — including the fivecomponents/app/screens that exist only in the design project — and the 21 that mirror intods/were re-pulled.React.JSX.Element, not an added importThese files already use
React.ReactNodeandReact.CSSPropertiesoff the UMD global without importing React, and those resolve fine — only the bareJSXnamespace didn't. Qualifying it keeps the house style untouched and adds no imports.Verification
tscoverds/**/*.d.tswithout--skipLibCheckJSX.Elementline./node_modules/.bin/biome check .npm run typecheck(web)npm run build(web)The read-back step is deliberate: in HT-94 a
write_filesreturned success and silently did not apply, which only surfaced later during a byte-comparison. Success from that call is not proof it landed.Not in this PR
skipLibCheck: trueis what hid this. Turning it off may surface unrelated third-party noise, so it's a separate judgement call rather than a drive-by change here.npx biomein this repo resolves to an unrelated stub package at 0.3.3 and exits 0 having processed zero files. The real binary is./node_modules/.bin/biomeat the repo root, which is what produced the result above.🤖 Generated with Claude Code
Summary by CodeRabbit