-
Notifications
You must be signed in to change notification settings - Fork 49
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Observed behavior
I have just upgraded a Typescript codebase to React 19 and observed the following TS error
'OpenFeatureProvider' cannot be used as a JSX component.
Its type '({ client, domain, children, ...options }: ProviderProps) => Element' is not a valid JSX element type.
Type '({ client, domain, children, ...options }: ProviderProps) => Element' is not assignable to type '(props: any) => ReactNode | Promise<ReactNode>'.
Type 'Element' is not assignable to type 'ReactNode | Promise<ReactNode>'.
Property 'children' is missing in type 'ReactElement<any, any>' but required in type 'ReactPortal'.
The React OpenFeatureProvider is typed to return a JSX.Element, in React 19 this is considered too narrow for a component return type (TS now expects all potential return types including a ReactPortal etc.)
I'd happily work on a PR to update the type signature for the provider but keen to hear thoughts regarding backwards compatibility etc. AFAIK ReactElement should be compatible with existing usage.
Expected Behavior
Able to use OpenFeatureProvider without TS errors
Steps to reproduce
In a React 19 Typescript project create a functional component that returns JSX with OpenFeatureProvider as the parent element.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working