Skip to content
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

fix(nuxt): add missing type for head in defineNuxtComponent #25410

Merged

Conversation

mateuszkulpa
Copy link
Contributor

πŸ”— Linked issue

#24811

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Fixes missing type definition for head function in the defineNuxtComponent

Resolves #24811

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have added tests (if possible).
  • I have updated the documentation accordingly.

Copy link

stackblitz bot commented Jan 24, 2024

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

@@ -32,4 +33,7 @@ declare module 'vue' {
interface ComponentInternalInstance {
_nuxtOnBeforeMountCbs: Function[]
}
interface ComponentCustomOptions {
head?(nuxtApp: NuxtApp): UseHeadInput
Copy link
Member

Choose a reason for hiding this comment

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

I guess the only issue here is that this will mark this as a valid type for defineComponent as well, right? Is there a way we can disallow that, or perhaps we could add a JSdoc comment here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added a comment. I tried to extend the type exclusively for defineNuxtComponent, but this would have required copying many types from vue, as defineComponent has numerous overloads. If you have any ideas for a better approach, I am open to suggestions for improvement.

@danielroe danielroe merged commit b5981f6 into nuxt:main Feb 22, 2024
33 of 34 checks passed
@github-actions github-actions bot mentioned this pull request Feb 22, 2024
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.

Type missing: for head(nuxtApp) {}
3 participants