Skip to content

Conversation

@Norbiros
Copy link
Contributor

@Norbiros Norbiros commented May 7, 2025

πŸ”— Linked issue

❓ 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

We were trying to create USelect for bool type and it haven't worked. I allowed all other primitive types that are intented to be used here (no array, objects etc).

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@pkg-pr-new
Copy link

pkg-pr-new bot commented May 7, 2025

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

commit: 4685f6e

@benjamincanac benjamincanac requested a review from sandros94 May 8, 2025 17:09
@sandros94
Copy link
Member

Indeed interesting, as upstream they have typed to accept only type AcceptableValue = string | number | Record<string, any> | null.

I think the addition of new types should be done upstream and not here. Tho the typing for USelect's value needs to be fixed

@Norbiros
Copy link
Contributor Author

Norbiros commented May 8, 2025

Interestingly, it doesn't produce any type errors... They explicitly removed boolean from the AcceptableValue in unovue/reka-ui@b567c7a. So maybe for now I could leave here AcceptableValue | boolean, open PR in reka with bigint | symbol and open an issue about using bool in Select?

@sandros94
Copy link
Member

Interestingly, it doesn't produce any type errors... They explicitly removed boolean from the AcceptableValue in unovue/reka-ui@b567c7a. So maybe for now I could leave here AcceptableValue | boolean, open PR in reka with bigint | symbol and open an issue about using bool in Select?

It doesn't create any error because SelectItemBase is the base type for the items prop. In Reka's term we are using Record<string, any>, so I totally agree to make it value?: AcceptableValue | boolean.

For the other types indeed, should be implemented upstream (hoping there aren't any issue with those, tho symbol might have).

@benjamincanac
Copy link
Member

@sandros94 Shouldn't we juste remove the value field like you did on InputMenu and SelectMenu? πŸ€”

@sandros94
Copy link
Member

@sandros94 Shouldn't we juste remove the value field like you did on InputMenu and SelectMenu? πŸ€”

no because we currently have valueKey defaulting to value, while for SelectMenu and InputMenu we don't.

valueKey: 'value' as never,

We could remove both to make Select follow the same api from the other two tho, but I might be missing an issue I've found in the past which led me leave it when I was doing the type rewrite πŸ€”

@benjamincanac benjamincanac changed the title feat(Select): support more primitive types in the value field fix(Select): support more primitive types in the value field May 10, 2025
@Norbiros Norbiros force-pushed the feat/support-more-value-types-in-select branch from 54281c2 to 4685f6e Compare May 10, 2025 12:45
@Norbiros
Copy link
Contributor Author

Do I have to do something more or this can get merged?

@benjamincanac benjamincanac changed the title fix(Select): support more primitive types in the value field fix(Select): support more primitive types in value field May 10, 2025
@benjamincanac benjamincanac merged commit 09b4699 into nuxt:v3 May 10, 2025
6 checks passed
@benjamincanac benjamincanac added the v3 #1289 label Aug 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v3 #1289

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants