-
-
Notifications
You must be signed in to change notification settings - Fork 656
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(jsx): allow null, undefined, and boolean to be returned from function component #3241
Conversation
…m function component
Empty Fragment is converted to null in `"jsx": "precompile"`, so add a test for that pattern
@yusukebe Would you please review? |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3241 +/- ##
=======================================
Coverage 96.21% 96.21%
=======================================
Files 151 151
Lines 15102 15105 +3
Branches 2660 2664 +4
=======================================
+ Hits 14530 14533 +3
Misses 572 572 ☔ View full report in Codecov by Sentry. |
Okay! I'll do it later. |
Hi @usualoma Looks good. I want to know:
Does this issue already exist before this PR (Or #3235)? As you said, I also think we should not include the change in this PR. |
Thanks for the review! The I think it would be better to include |
Thank you for your reply.
I agree 👍 Now, let's merge this one! |
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!
[](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [hono](https://hono.dev/) ([source](https://togithub.com/honojs/hono)) | [`4.5.4` -> `4.5.5`](https://renovatebot.com/diffs/npm/hono/4.5.4/4.5.5) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>honojs/hono (hono)</summary> ### [`v4.5.5`](https://togithub.com/honojs/hono/releases/tag/v4.5.5) [Compare Source](https://togithub.com/honojs/hono/compare/v4.5.4...v4.5.5) #### What's Changed - fix(jsx): allow null, undefined, and boolean to be returned from function component by [@​usualoma](https://togithub.com/usualoma) in [https://github.com/honojs/hono/pull/3241](https://togithub.com/honojs/hono/pull/3241) - feat(context): Add types for `c.header` by [@​nakasyou](https://togithub.com/nakasyou) in [https://github.com/honojs/hono/pull/3221](https://togithub.com/honojs/hono/pull/3221) - fix(jsx): fix draggable type to accept boolean by [@​yasuaki640](https://togithub.com/yasuaki640) in [https://github.com/honojs/hono/pull/3253](https://togithub.com/honojs/hono/pull/3253) - feat(context): add Context-Type types to `c.header` by [@​nakasyou](https://togithub.com/nakasyou) in [https://github.com/honojs/hono/pull/3255](https://togithub.com/honojs/hono/pull/3255) - fix(serve-static): supports directory contains `.` and not end `/` by [@​yusukebe](https://togithub.com/yusukebe) in [https://github.com/honojs/hono/pull/3256](https://togithub.com/honojs/hono/pull/3256) **Full Changelog**: honojs/hono@v4.5.4...v4.5.5 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "before 4am on Monday" in timezone America/Chicago, Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View the [repository job log](https://developer.mend.io/github/autoblocksai/cli). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4yMC4xIiwidXBkYXRlZEluVmVyIjoiMzguMjAuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
fixes #3235
The deno converts an empty
Fragment
tonull
when the value of the "jsx" entry is "precompile", but "hono/jsx" was not able to handle the function component returningnull
, which caused the problem #3235.What should be the returned value of an
FC
type?In the current React type definition,
FunctionComponent
returns theReactNode
, and sinceReactNode
also includesboolean
andundefined
, it would be preferable if Hono'sFC
also included these (boolean
andundefined
).https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react/index.d.ts#L1114-L1122
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react/index.d.ts#L478-L489
However, the changes to add
undefined
andboolean
have a considerable impact on existing code, so I have chosen not to do so in this pull request. I would like to discuss this at another time.The author should do the following, if applicable
bun run format:fix && bun run lint:fix
to format the code