Skip to content

Conversation

@andomain
Copy link

This PR

This PR removes the explicit JSX.Element return type from the type signature of the React SDK OpenFeatureProvider.
JSX.Element is narrow for React 19+ as types have widened to include Portals etc. & this was throwing TS compilation errors

Related Issues

Fixes #1307

Notes

As this is purely a type change I didn't feel it necessary to add additional tests, happy to investigate further if required though

`JSX.Element` too narrow for React 19+ as types have widened to include Portals etc

Signed-off-by: Sam <sam@andomain.co.uk>
@andomain andomain requested review from a team as code owners December 10, 2025 08:25
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @andomain, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request updates the React SDK to improve its compatibility with newer React versions, specifically React 19 and beyond. By removing a restrictive type annotation from the OpenFeatureProvider component, it resolves TypeScript compilation issues and ensures the component's return type correctly accommodates the broader range of valid React elements, such as Portals.

Highlights

  • React Type Compatibility: Removed the explicit JSX.Element return type from the OpenFeatureProvider function in the React SDK.
  • TypeScript Error Resolution: This change resolves TypeScript compilation errors that arise in React 19+ environments due to JSX.Element being too narrow for modern React component return types, which now include elements like Portals.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request removes the explicit JSX.Element return type from the OpenFeatureProvider component to improve compatibility with newer versions of React. The change is correct and well-justified. I've added one suggestion to improve the related JSDoc for better clarity and correctness.

* @returns {OpenFeatureProvider} context provider
*/
export function OpenFeatureProvider({ client, domain, children, ...options }: ProviderProps): JSX.Element {
export function OpenFeatureProvider({ client, domain, children, ...options }: ProviderProps) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The JSDoc for the return value on line 32 is misleading. @returns {OpenFeatureProvider} uses the function's name instead of its return type. For better clarity and correctness, please consider updating it to specify that the function returns a JSX element.

For example:

* @returns {JSX.Element} The OpenFeature provider component.

I'm placing this comment here as I'm unable to comment on unchanged lines.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will leave this as is as it is how the function was typed before and indicated it returns the context provider itself

@andomain andomain changed the title Remove explicit return type for React OpenFeatureProvider fix: remove explicit return type for React OpenFeatureProvider Dec 10, 2025
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.

[BUG] React OpenFeatureProvider types as JSX.Element conflicts in React 19

2 participants