Skip to content

feat(jsx-renderer): support function-based options#4780

Merged
yusukebe merged 1 commit intohonojs:mainfrom
3w36zj6:feature/support-function-based-options-for-jsx-renderer
Mar 10, 2026
Merged

feat(jsx-renderer): support function-based options#4780
yusukebe merged 1 commit intohonojs:mainfrom
3w36zj6:feature/support-function-based-options-for-jsx-renderer

Conversation

@3w36zj6
Copy link
Contributor

@3w36zj6 3w36zj6 commented Mar 3, 2026

cf. #1977 (comment)

The author should do the following, if applicable

  • Add tests
  • Run tests
  • bun run format:fix && bun run lint:fix to format the code
  • Add TSDoc/JSDoc to document the code

@codecov
Copy link

codecov bot commented Mar 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.46%. Comparing base (19d20d2) to head (c4bb62c).
⚠️ Report is 10 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4780   +/-   ##
=======================================
  Coverage   91.46%   91.46%           
=======================================
  Files         177      177           
  Lines       11563    11568    +5     
  Branches     3360     3361    +1     
=======================================
+ Hits        10576    10581    +5     
  Misses        986      986           
  Partials        1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment on lines -110 to +118
export const jsxRenderer = (
export const jsxRenderer = <E extends Env = Env>(
component?: ComponentWithChildren,
options?: RendererOptions
options?: RendererOptions | ((c: Context<E>) => RendererOptions)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To provide type inference for Env, I implemented it based on the example at:

export const serveStatic = <E extends Env = Env>(

It would be convenient if the type of env is inherited from the Hono instance without needing to explicitly specify type arguments, but I think this would require changes to src/types.ts.

@3w36zj6 3w36zj6 marked this pull request as ready for review March 3, 2026 13:00
@yusukebe yusukebe added the v4.13 label Mar 10, 2026
Copy link
Member

@yusukebe yusukebe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@yusukebe yusukebe added approved and removed v4.13 labels Mar 10, 2026
@yusukebe
Copy link
Member

Hey @3w36zj6

This is good! This is a new feature, but it's slight, so I'll merge it into the main immediately and release it as a patch release. Thanks!

@yusukebe yusukebe merged commit 58825a7 into honojs:main Mar 10, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants