Conversation
WalkthroughType-level routing infrastructure expanded: new utilities UnwrapRouteInput, InferRouteInput, StripRouteInput added; Elysia class gains a generic Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/index.ts`:
- Around line 230-231: The current type alias RoutesInput (declared as RouteBase
& InferRouteInput<Routes>) is being lost during composition because downstream
signatures derive from StripRouteInput<Routes> (i.e., NewElysia['~Routes'])
which strips input metadata; update the composition return types to explicitly
thread and merge RoutesInput (e.g., merge with NewElysia['~RoutesInput'])
instead of re-deriving only from StripRouteInput<Routes>, and adjust affected
composition helpers (use, group, guard and any functions producing NewElysia) so
they carry and combine NewElysia['~RoutesInput'] alongside NewElysia['~Routes']
to preserve route-input metadata across merges.
|
Solves #1748 |
|
Added Code Rabbit suggestion |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/index.ts (1)
5798-5803: Consider extracting a helper alias for repeated route-input unwrapping.The repeated
UnwrapRouteInput<Input, Definitions['typebox'], JoinPath<BasePath, Path>>pattern across handlers is correct but verbose; a local type alias would reduce duplication and drift risk.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/index.ts` around lines 5798 - 5803, Create a local type alias to reduce repeated verbosity of UnwrapRouteInput by declaring something like RouteInput<Input, Path> = UnwrapRouteInput<Input, Definitions['typebox'], JoinPath<BasePath, Path>> near the handlers; then replace occurrences of UnwrapRouteInput<Input, Definitions['typebox'], JoinPath<BasePath, Path>> with the new alias (referencing the existing symbols UnwrapRouteInput, Definitions['typebox'], JoinPath, BasePath, Path) so all handlers use the shorter RouteInput alias and avoid duplication.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/index.ts`:
- Around line 5798-5803: Create a local type alias to reduce repeated verbosity
of UnwrapRouteInput by declaring something like RouteInput<Input, Path> =
UnwrapRouteInput<Input, Definitions['typebox'], JoinPath<BasePath, Path>> near
the handlers; then replace occurrences of UnwrapRouteInput<Input,
Definitions['typebox'], JoinPath<BasePath, Path>> with the new alias
(referencing the existing symbols UnwrapRouteInput, Definitions['typebox'],
JoinPath, BasePath, Path) so all handlers use the shorter RouteInput alias and
avoid duplication.
Export RouteInput type to fix a bug in elysia/eden
Today
Elysia/edenis unable to infer the route input type, this pull request aims to fix this issue by exporting its input types.Summary by CodeRabbit
New Features
Tests
Notes