feat(jsx-renderer): support function-based options#4780
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
| export const jsxRenderer = ( | ||
| export const jsxRenderer = <E extends Env = Env>( | ||
| component?: ComponentWithChildren, | ||
| options?: RendererOptions | ||
| options?: RendererOptions | ((c: Context<E>) => RendererOptions) |
There was a problem hiding this comment.
To provide type inference for Env, I implemented it based on the example at:
hono/src/middleware/serve-static/index.ts
Line 35 in 6a0607a
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.
|
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! |
cf. #1977 (comment)
The author should do the following, if applicable
bun run format:fix && bun run lint:fixto format the code