onesine / react-tailwindcss-select

Tailwind Select Component for React.js
https://demo-react-tailwindcss-select.vercel.app/
MIT License
183 stars 38 forks source link

Export SelectProps and Option #31

Closed timothyarmes closed 1 year ago

timothyarmes commented 1 year ago

In order to create a wrapper around Select, it's would be useful to be able to import the SelectProps and Option type. Currently this isn't exported. I can to this myself using some TS magic:

type SelectProps = (typeof Select) extends React.FC<infer X> ? X : never;
type Option = SelectProps["formatOptionLabel"] extends ((data: infer X) => JSX.Element) | null | undefined ? X : never;

but exporting the types would be the best solution

soutot commented 1 year ago

Hi @onesine, in order to use the SelectProps, currently we need to import it from the dist folder like this import { SelectProps } from 'react-tailwindcss-select/dist/components/type' Generally, the packages would allow us to do something like this import Select, { SelectProps } from 'react-tailwindcss-select'

Is it ok to keep importing from the dist or do you have any plans on updating it?

Thanks in advance!