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: Remove optionality from required types #401

Merged
merged 2 commits into from
Jul 19, 2024
Merged

Conversation

vcapretz
Copy link
Member

this fixes a longstanding issue with inconsistencies around types for the react prop specifically

by using the RequireAtLeastOne generic we are already telling TS that all props are optional, but at least one is required. but having the ? mark in the react prop we confuse the compiler since undefined is not a valid React Node element and it breaks.

so for a while now we have users sometimes having to cast React.ReactNode types to React.ReactElement and some other workarounds.

this should no longer be needed and we now have type consistency 🙏

@vcapretz vcapretz self-assigned this Jul 19, 2024
@vcapretz vcapretz requested a review from a team as a code owner July 19, 2024 14:20
@vcapretz vcapretz merged commit d7c6d6e into canary Jul 19, 2024
8 checks passed
@vcapretz vcapretz deleted the fix-required-types branch July 19, 2024 15:39
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