-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
docs: add default statusCode fallback to prevent 'error' is possibly undefined warning in error.vue
#33763
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
…y undefined warning in `error.vue`
|
|
|
Caution Review failedThe pull request is closed. WalkthroughUpdated the documentation example in docs/2.directory-structure/1.app/3.error.md to change the script-setup prop declaration for Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
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.
Example instruction:
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. Comment |
🤔 please do review the output of LLMs before using it, please 🙏 (I've written a bit about it here) |
danielroe
left a comment
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.
thank you! ❤️
🔗 Linked issue
resolves #
📚 Description
When first using the default
error.vuetemplate, TypeScript raised a warning:This happens because the
errorprop 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
errorprop is always defined, keeps the component stable, and maintains type safety without altering the UI or existing behavior.Additional small improvements:
NuxtErrortype definitionstatusCodeis missingWould you like help crafting tests for this PR? 😊