fix(docs): correct false claim that .mount() resolves to .use()#803
fix(docs): correct false claim that .mount() resolves to .use()#803braden-w wants to merge 1 commit intoelysiajs:mainfrom
Conversation
WalkthroughDocumentation updated to clarify that Elysia's Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 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)
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 `@docs/patterns/mount.md`:
- Around line 30-34: Update the typo in the tip text that mentions the standard:
change "WinterTC" to the correct name "WinterCG" where .mount is described (the
sentence about mounting non-Elysia, WinterTC-compliant handlers); keep the rest
of the text intact and ensure the .use() reference remains unchanged.
| ::: tip | ||
| **.mount** is intended for mounting non-Elysia, WinterTC-compliant handlers. Mounted routes are registered as a wildcard handler and are **not** included in OpenAPI/Swagger documentation, Eden Treaty type inference, or WebSocket support. | ||
|
|
||
| To compose Elysia instances with full type safety, Eden Treaty support, and OpenAPI documentation, use [**.use()**](/essential/plugin) instead. | ||
| ::: |
There was a problem hiding this comment.
Fix the standard name typo.
The tip box uses "WinterTC" but the correct name of the standard is "WinterCG" (Winter Community Group). This is inconsistent with the blog post (lines 118-122 of elysia-06.md) which correctly uses "WinterCG".
📝 Proposed fix
::: tip
-**.mount** is intended for mounting non-Elysia, WinterTC-compliant handlers. Mounted routes are registered as a wildcard handler and are **not** included in OpenAPI/Swagger documentation, Eden Treaty type inference, or WebSocket support.
+**.mount** is intended for mounting non-Elysia, WinterCG-compliant handlers. Mounted routes are registered as a wildcard handler and are **not** included in OpenAPI/Swagger documentation, Eden Treaty type inference, or WebSocket support.
To compose Elysia instances with full type safety, Eden Treaty support, and OpenAPI documentation, use [**.use()**](/essential/plugin) instead.
:::📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| ::: tip | |
| **.mount** is intended for mounting non-Elysia, WinterTC-compliant handlers. Mounted routes are registered as a wildcard handler and are **not** included in OpenAPI/Swagger documentation, Eden Treaty type inference, or WebSocket support. | |
| To compose Elysia instances with full type safety, Eden Treaty support, and OpenAPI documentation, use [**.use()**](/essential/plugin) instead. | |
| ::: | |
| ::: tip | |
| **.mount** is intended for mounting non-Elysia, WinterCG-compliant handlers. Mounted routes are registered as a wildcard handler and are **not** included in OpenAPI/Swagger documentation, Eden Treaty type inference, or WebSocket support. | |
| To compose Elysia instances with full type safety, Eden Treaty support, and OpenAPI documentation, use [**.use()**](/essential/plugin) instead. | |
| ::: |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@docs/patterns/mount.md` around lines 30 - 34, Update the typo in the tip text
that mentions the standard: change "WinterTC" to the correct name "WinterCG"
where .mount is described (the sentence about mounting non-Elysia,
WinterTC-compliant handlers); keep the rest of the text intact and ensure the
.use() reference remains unchanged.
…lysia instances .mount() always extracts the .fetch handler — it never calls .use(). Mounted routes are registered as hidden wildcard handlers without type inference, Eden Treaty, or OpenAPI support. Added clarifying tip to the mount docs page and a correction notice on the 0.6 blog post.
74a6844 to
93c77de
Compare
The Elysia 0.6 release blog and the main mount documentation page both claim that passing an Elysia instance to
.mount()will "resolve touseautomatically, providing type-safety and support for Eden by default." This isn't true, and hasn't been for some time.What
.mount()actually doesLooking at the Elysia source (
src/index.ts#L5544-L5655), the mount method handles an Elysia instance by calling.compile()on it and then extracting its.fetch— the exact same thing it does for any other WinterCG-compliant handler. There is no call to.use()anywhere in the method.Here's the relevant source, annotated:
Why the documentation claim is wrong
The code above shows that
mount()never calls.use(). For both code paths (with and without a path prefix), an Elysia instance is treated identically to a Hono app or any other fetch-compatible handler:.compile().fetch— the Elysia instance is compiled down to a single(Request) => Responsefunctionparse: 'none'— no Elysia body parsing; the raw request is passed through as-ishide: true— routes are explicitly hidden from the OpenAPI schema and type systemThis means:
The only difference between
mount(path, hono.fetch)andmount(path, elysiaApp)is that Elysia calls.compile()first. The end result is identical — it's a black-box fetch handler either way.