-
Notifications
You must be signed in to change notification settings - Fork 557
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
Require at least 1 child in JSX components #2466
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FrederikBolding
previously approved these changes
Jun 6, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but there are some type problems in CI it seems
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2466 +/- ##
=======================================
Coverage 94.33% 94.33%
=======================================
Files 438 438
Lines 9037 9039 +2
Branches 1384 1384
=======================================
+ Hits 8525 8527 +2
Misses 512 512 ☔ View full report in Codecov by Sentry. |
FrederikBolding
approved these changes
Jun 6, 2024
Mrtenz
added a commit
that referenced
this pull request
Jun 7, 2024
In #2466 we changed the types and validation of JSX components to use `NonEmptyArray<Type>` as children. This causes issues however when using utility functions like `.map()` and `.filter()`, since they return a regular `Type[]` type. This is not great for devex, since it would require type assertions everywhere. I've changed the types to accept `Type[]`, though we technically still validate `NonEmptyArray<Type>`.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This changes the types and validation for JSX components to require at least one child. Previously it was possible to do something like
<Box children={[]} />
, but this will now result in an error.