adobe / react-spectrum

A collection of libraries and tools that help you build adaptive, accessible, and robust user experiences.
https://react-spectrum.adobe.com
Apache License 2.0
12.45k stars 1.08k forks source link

useSelect example typescript support #6432

Closed Sxoo closed 3 months ago

Sxoo commented 3 months ago

๐Ÿ™‹ Documentation Request

https://react-spectrum.adobe.com/react-aria/useSelect.html#example

I am trying to use the example Select implementation together with a ListBox, Popover and Options but it seems that only a Popover is typed out of the box. I was wondering maybe an example of types could be provided to type out these components more easily?

The main problem occurs when I am trying to type out the Select props, I can't seem to type out the options in such a way that my onSelectionChange would not be a generic (key: Key) => any and I wouldn't need to type cast.

What am I missing?

๐Ÿงข Your Company/Team

No response

Sxoo commented 3 months ago

I had a revelation..