all components with onSelectionChange have a bad api design #2151
Closed
thisisamir98
started this conversation in
Feedback
Replies: 1 comment
-
closing as the author of nextui pointed out that the Selection API comes from react-aria. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Problem Description
The Selection type in Nextui with TypeScript has a few issues that impact its usability and correctness.
Issues Identified
Cannot Retrieve Length
The Selection type, which can be either 'all' or a Set, lacks a consistent way to retrieve its length.
This makes it challenging to perform operations that require knowledge of the number of elements in the selection.
Limited Iteration Support
The Selection type currently only offers methods like toString or valueOf in TypeScript.
This limitation prevents convenient iteration over the selection, hindering common use cases.
Error in Official Docs Example
The example provided in the official documentation leads to a TypeScript error:
Nextui Version: 2.2.9
TypeScript Version: 5.3.3
Beta Was this translation helpful? Give feedback.
All reactions