-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
docs: move augmenting hook types in hooks page #32595
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
Conversation
|
WalkthroughThe documentation regarding Nuxt hook type augmentation has been reorganised. The detailed "Augmenting Types" section with TypeScript examples was removed from the "Events" page and replaced by a concise callout linking to additional information. Meanwhile, the "Hooks" page was updated: its section was renamed "Adding Custom Hooks" and now provides explicit explanations and TypeScript code examples for augmenting Nuxt and Nitro hook interfaces via module augmentation. These changes are purely documentation updates and do not affect any exported or public entities in the source code. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
✨ Finishing Touches🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
docs/2.guide/3.going-further/2.hooks.md (1)
77-98
: Double-check Nitropack module path & add missing semicolons
The augmentation for Nitro uses
declare module 'nitropack/types'
. In Nitro’s published typings, the public module is usuallynitropack
(root), not the pseudo-pathnitropack/types
. Please verify – a wrong module name will silently defeat the augmentation.For consistency with the rest of the snippet and common TS style, append semicolons to the interface properties.
Example fix:
-declare module 'nitropack/types' { +declare module 'nitropack' { interface NitroRuntimeHooks { - 'your-nitro-hook': () => void; + 'your-nitro-hook': () => void; } }and
- 'your-nuxt-runtime-hook': () => HookResult + 'your-nuxt-runtime-hook': () => HookResult; ... - 'your-nuxt-hook': () => HookResult + 'your-nuxt-hook': () => HookResult;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
docs/2.guide/3.going-further/1.events.md
(1 hunks)docs/2.guide/3.going-further/2.hooks.md
(1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: Tofandel
PR: nuxt/nuxt#0
File: :0-0
Timestamp: 2024-11-11T12:34:22.648Z
Learning: Ensure that AI-generated summaries accurately reflect the key changes in the PR, focusing on notable changes such as the removal of unused imports and variables starting with underscores.
Learnt from: Tofandel
PR: nuxt/nuxt#26468
File: packages/nuxt/src/components/runtime/client-delayed-component.ts:62-62
Timestamp: 2024-11-05T20:04:39.622Z
Learning: In Vue components, when typing the `hydrate` prop for hydration strategies like `hydrateOnInteraction`, use `type: null as PropType<Arguments<typeof hydrateOnInteraction>[0]>` to get the type directly from Vue's hydration methods. Also, remember that `HTMLElementEventMap` is not a type but an object; use `keyof HTMLElementEventMap` when defining prop types for events.
Learnt from: CR
PR: nuxt/nuxt#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-30T13:48:28.134Z
Learning: Applies to **/*.{ts,tsx} : Follow standard TypeScript conventions and best practices
docs/2.guide/3.going-further/1.events.md (5)
Learnt from: Tofandel
PR: nuxt/nuxt#0
File: :0-0
Timestamp: 2024-11-11T12:34:22.648Z
Learning: Ensure that AI-generated summaries accurately reflect the key changes in the PR, focusing on notable changes such as the removal of unused imports and variables starting with underscores.
Learnt from: CR
PR: nuxt/nuxt#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-30T13:48:28.134Z
Learning: Applies to **/*.{ts,tsx,vue} : Add comments only to explain complex logic or non-obvious implementations
Learnt from: CR
PR: nuxt/nuxt#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-30T13:48:28.134Z
Learning: Applies to **/*.{ts,tsx,vue} : Remove code that is not used or needed
Learnt from: GalacticHypernova
PR: nuxt/nuxt#26468
File: packages/nuxt/src/components/plugins/loader.ts:24-24
Timestamp: 2024-11-05T15:22:54.759Z
Learning: In `packages/nuxt/src/components/plugins/loader.ts`, the references to `resolve` and `distDir` are legacy code from before Nuxt used the new unplugin VFS and will be removed.
Learnt from: CR
PR: nuxt/nuxt#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-30T13:48:28.134Z
Learning: Applies to **/*.{ts,tsx} : Follow standard TypeScript conventions and best practices
docs/2.guide/3.going-further/2.hooks.md (1)
Learnt from: Tofandel
PR: nuxt/nuxt#0
File: :0-0
Timestamp: 2024-11-11T12:34:22.648Z
Learning: Ensure that AI-generated summaries accurately reflect the key changes in the PR, focusing on notable changes such as the removal of unused imports and variables starting with underscores.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: link-checker
- GitHub Check: lint-docs
::read-more{to="/docs/2.guide/3.going-further/2.hooks.md"} | ||
Learn more about Nuxt's built-in hooks and how to extend them | ||
:: |
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.
Fix broken “read-more” link
The target path includes the numeric directory prefix and the .md
extension, which the docs router strips at build time. This will generate a 404.
-::read-more{to="/docs/2.guide/3.going-further/2.hooks.md"}
+::read-more{to="/docs/guide/going-further/hooks#augmenting-types"}
📝 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.
::read-more{to="/docs/2.guide/3.going-further/2.hooks.md"} | |
Learn more about Nuxt's built-in hooks and how to extend them | |
:: | |
::read-more{to="/docs/guide/going-further/hooks#augmenting-types"} | |
Learn more about Nuxt's built-in hooks and how to extend them | |
:: |
🤖 Prompt for AI Agents
In docs/2.guide/3.going-further/1.events.md around lines 61 to 63, the read-more
link target includes the numeric directory prefix and the .md extension, which
causes a 404 error because the docs router strips these at build time. Remove
the numeric prefix and the .md extension from the target path so it matches the
router's expected format, for example, change
"/docs/2.guide/3.going-further/2.hooks.md" to "/docs/guide/going-further/hooks".
🔗 Linked issue
📚 Description
A small issue I noticed in the doc.
We should show how to extend hooks within the hooks page, not in the event page. It's currently a bit harder for users to find the doc about how to extend hooks.