Skip to content

Conversation

@edwinsamodra
Copy link
Contributor

🔗 Linked issue

resolves #

📚 Description

When first using the default error.vue template, TypeScript raised a warning:

'__VLS_ctx.error' is possibly 'undefined'.

This happens because the error prop doesn’t define any fallback value, so TypeScript considers it optional.
To avoid that warning and prevent potential runtime issues when Nuxt renders an error without a full payload, a default object containing { statusCode: 500 } is added.

This ensures the error prop is always defined, keeps the component stable, and maintains type safety without altering the UI or existing behavior.

Additional small improvements:

  • Preserves the NuxtError type definition
  • Provides a safer default for edge cases where statusCode is missing

Would you like help crafting tests for this PR? 😊

@bolt-new-by-stackblitz
Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@coderabbitai
Copy link

coderabbitai bot commented Nov 25, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Updated the documentation example in docs/2.directory-structure/1.app/3.error.md to change the script-setup prop declaration for error from a runtime prop object:
const props = defineProps({
error: Object as () => NuxtError,
})
to a TypeScript-generic form:
const props = defineProps<{ error: NuxtError }>()
This replaces object-based prop options (and runtime validation/defaults) with a type-only declaration; no default value was added.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Verify the defineProps<{ error: NuxtError }>() syntax is valid TypeScript + Vue 3 script-setup.
  • Check for any downstream examples or docs that relied on runtime prop options or defaults.
  • Confirm the example compiles with the project's TypeScript/ESLint configuration.
  • Review docs/2.directory-structure/1.app/3.error.md for consistency with surrounding documentation.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding a default statusCode fallback to the error prop in error.vue to resolve a TypeScript warning.
Description check ✅ Passed The description is directly related to the changeset, providing context about the TypeScript warning, explaining the rationale for the change, and describing the implementation details.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 781bbe7 and 5d7bbbc.

📒 Files selected for processing (1)
  • docs/2.directory-structure/1.app/3.error.md (1 hunks)

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@danielroe
Copy link
Member

Would you like help crafting tests for this PR? 😊

🤔

please do review the output of LLMs before using it, please 🙏 (I've written a bit about it here)

Copy link
Member

@danielroe danielroe left a comment

Choose a reason for hiding this comment

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

thank you! ❤️

@danielroe danielroe merged commit 7b594cc into nuxt:main Nov 25, 2025
6 of 8 checks passed
@github-actions github-actions bot mentioned this pull request Nov 24, 2025
danielroe pushed a commit that referenced this pull request Dec 9, 2025
@github-actions github-actions bot mentioned this pull request Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants