You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I sometimes have state that is represented as a string literal union type that I want to modify via a Select component, but I end up needing to do type casting in order to support this. I would like to not have to type cast.
I'm using this library via Park UI via Ark UI, so this change could be made at those levels as well (and would need to be piped through if it is implemented via Zag), but it felt like it made the most sense to do it at the base.
This discussion was converted from issue #1330 on March 09, 2024 01:08.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
First of all, thank you for all your work on this library!
🚀 Feature request
I would like to be able to use string literal types in the
select
machine, for example in thevalue
andonValueChange
(https://github.com/chakra-ui/zag/blob/main/packages/machines/select/src/select.types.ts#L12), but because it is typed as astring
, rather than a generic like<Values extends string = string>
, my literal types get dropped.🧱 Problem Statement / Justification
I sometimes have state that is represented as a string literal union type that I want to modify via a Select component, but I end up needing to do type casting in order to support this. I would like to not have to type cast.
✅ Proposed solution or API
Update https://github.com/chakra-ui/zag/blob/main/packages/machines/select/src/select.types.ts
to
And any necessary piping through to above layers
↩️ Alternatives + Additional Information
I'm using this library via Park UI via Ark UI, so this change could be made at those levels as well (and would need to be piped through if it is implemented via Zag), but it felt like it made the most sense to do it at the base.
Beta Was this translation helpful? Give feedback.
All reactions