fix: replace JSX.Element with React.ReactElement for React 19 compatibility#732
fix: replace JSX.Element with React.ReactElement for React 19 compatibility#732tyler-reitz wants to merge 6 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates several component return types and prop types from JSX.Element to React.ReactElement across auth.tsx, performance.tsx, sdk.tsx, and storage.tsx. The review feedback suggests using React.ReactNode instead of React.ReactElement for the placeHolder prop in storage.tsx to allow for more flexible types like strings or numbers, and consequently updating the return type of INTERNALStorageImage to React.ReactNode as well.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
JSX.Element was removed from the global JSX namespace in React 19 types. Components returning JSX.Element are no longer assignable to the updated ReactNode return type, causing type errors for users on React 19. Fixes FirebaseExtended#637
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
337af09 to
4121709
Compare
armando-navarro
left a comment
There was a problem hiding this comment.
The PR description might be a little misleading now with regard to the storage change, which becomes the squash merge commit body. Very minor, but might want to update that before merging.
One possible follow-up issue I found is that CI only type-checks against @types/react 18, so nothing stops a global JSX.Element from creeping back in and re-breaking React 19 consumers. A small CI step that packs the build and runs tsc over a fixture with @types/react@19 (and 18) would lock this fix in.
Approving the PR.
Problem
Since React 19 removed
JSX.Elementfrom the globalJSXnamespace, components in reactfire that returnJSX.Elementno longer type-check:Fix
Replace all
JSX.Elementreturn type annotations withReact.ReactElement, which is the equivalent type and works correctly with both React 18 and React 19 types. This is not a breaking change —JSX.Elementwas always an alias forReact.ReactElement<any, any>.Changed in 4 places:
src/sdk.tsx—SdkProvider(coversAuthProviderand all other SDK providers)src/auth.tsx—AuthChecksrc/performance.tsx—SuspenseWithPerfsrc/storage.tsx—INTERNALStorageImagereturn type andplaceHolderprop typeFixes #637