Skip to content
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

fix(react): updates Portal to have backward compatibility #2155

Merged
merged 1 commit into from
Feb 10, 2024

Conversation

irwinarruda
Copy link
Contributor

@irwinarruda irwinarruda commented Feb 9, 2024

Fixes #2154 and #1787

There were a lot of ways this could be solved, most of them are by working around typescript. I decided to push the most type-safe solution since Portal's return type now gets inferred as JSX.Element, so the code will work on all versions of @types/react@18. The only downside is adding a Fragment without actually needing it.

I also added some tests for the Portal component since there weren't any :)

Copy link

vercel bot commented Feb 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
ark-docs ✅ Ready (Inspect) Visit Preview Feb 9, 2024 3:13am

@Omikorin
Copy link
Collaborator

Omikorin commented Feb 10, 2024

Thanks! Awesome

@Omikorin Omikorin merged commit 2543abc into chakra-ui:main Feb 10, 2024
7 checks 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.

Portal return types are not compatible with some versions of @types/react.
2 participants