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(components): improve generic types #3331

Open
wants to merge 109 commits into
base: v3
Choose a base branch
from
Open

fix(components): improve generic types #3331

wants to merge 109 commits into from

Conversation

sandros94
Copy link
Member

@sandros94 sandros94 commented Feb 16, 2025

πŸ”— Linked issue

Resolves #2140
Also discussed privately and https://github.com/nuxt/ui-pro/pull/753#issuecomment-2625295701

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ 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

The main goal for this PR is to both simplify the use of types as well as properly document them for each component that might use them.

Notes

  • I'm not adding type examples for some components, like Carousel, because the inferred string[] is more than enough.
  • Commit 5203359 might seem a breaking change (order of type generics), but it is how it should actually work (it also standardize between components).
  • CommandPalette ([CommandPalette] Generics not working well with items inside groupsΒ #2260) will require additional work in separate PR. Similarly for named slots within children (for those components that do support it), as they might require a similar approach.
  • Some components, like Breadcrumb have a labelKey?: string that I was looking for changing with proper typing, but for some reason they all break the forwarding of props

πŸ“ Components Checklist

As this PR touches basically almost all components here is a brief description on what changed for what component.

Legend

  • docs: means types have been added to doc (both markdown as well as vue component examples)
  • examples: means that types have been added only to related component example in docs
  • generics: means that I both added default types to generics as well as I might have reordered them (I don't consider this change a breaking change because it favors proper behavior)
  • dynamics: means that the component has been fully worked on and support proper dynamic typing based on input props (both arrays, nested ones, filters, modelValues, label/value keys)
  • *: means that I might need an additional verification before merge

Components

  • Accordion: docs, generics (ui-pro typecheck error, as expected)
  • Breadcrumb: docs, generics
  • ButtonGroup: examples
  • Calendar: generics
  • Carousel: generics
  • CommandPalette: probably will be covered in different PR
  • ContextMenu: docs, generics, dynamics
  • DropdownMenu: docs, generics, dynamics
  • Form: examples
  • InputMenu: examples, generics, dynamics
  • NavigationMenu: docs, generics, dynamics
  • RadioGroup: docs, generics *
  • Select: examples, generics, dynamics
  • SelectMenu: examples, generics, dynamics
  • Stepper: docs, generics
  • Table: probably will be covered in different PR
  • Tabs: docs, generics

Copy link

pkg-pr-new bot commented Feb 16, 2025

npm i https://pkg.pr.new/@nuxt/ui@3331

commit: 2564b17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[NavigationMenu/DropdownMenu/ContextMenu] Generic type doesn't work when passing links as [][]
3 participants