Description
Description
Menu onSelectionChange not resolving to correct type.
CodeSandbox/Snack link
https://snack.expo.dev/@trumpet2012/gluestack-menu-typescript-issue
Steps to reproduce
See provided snack link for reproducible issue (note that the types aren't working in the snack for some reason but that code is enough to see the issue locally)
This is a copy of the example from the docs: https://v1.gluestack.io/ui/docs/components/overlay/menu#selection.
The typescript error is:
Property 'currentKey' does not exist on type 'Selection'.
Property 'currentKey' does not exist on type '"all"'.
Adding an extra check to ensure that "keys" isn't "all"
then leads to the following typescript error:
Property 'currentKey' does not exist on type 'Set<Key>'.
gluestack-ui Version
1.1.42
Platform
- Expo
- React Native CLI
- Next
- Web
- Android
- iOS
Other Platform
No response
Additional Information
The type for the "keys" argument appears to be resolving to: https://github.com/adobe/react-spectrum/blob/8ee84717884461e0646236b77c9e43c5d14e3533/packages/%40react-types/shared/src/selection.d.ts#L28
However the actual keys object type looks like it should be using: https://github.com/adobe/react-spectrum/blob/8ee84717884461e0646236b77c9e43c5d14e3533/packages/%40react-stately/selection/src/Selection.ts#L19.
Metadata
Metadata
Assignees
Type
Projects
Status