Skip to content

Align FlagsmithProvider children prop type with React.ReactNode in declaration file #317

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 2, 2025

Conversation

dreglad
Copy link
Contributor

@dreglad dreglad commented Jun 1, 2025

This PR resolves a remaining type inconsistency related to issue #268 and PR #270 regarding the FlagsmithProvider component, where its children prop in the TypeScript declaration file (react.d.ts) mismatched the React.ReactNode type used in the implementation (react.tsx).

Also added a test to test/react-types.test.tsx to assert that FlagsmithProvider renders a React.ReactNode correctly and the TS declaration file types match the implementation file (otherwise the test itself fails to compile).

…ctNode

Ensures the `children` prop in `FlagsmithProvider`'s type definition (`FlagsmithContextType`) is correctly set to `React.ReactNode` in both the implementation (`react.tsx`) and the declaration file (`react.d.ts`).

Adds a type test to verify that `FlagsmithProvider` compiles successfully when provided with a plain string child, which is a valid `React.ReactNode`. This test would fail compilation if the type were incorrectly restricted (e.g., to `ReactElement | ReactElement[]`).
@tiagoapolo
Copy link
Contributor

tiagoapolo commented Jun 2, 2025

Thank you for your contribution!

@tiagoapolo tiagoapolo merged commit f57c9ed into Flagsmith:main Jun 2, 2025
1 check passed
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.

2 participants