JedWatson / JedWatson/react-select
TypeScript types: Group does not default to GroupBase<Option> in CreatableProps
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 28k
- Forks
- 4.1k
- PR merge metrics
- No merged PRs in 30d
Description
This is only a minor inconvenience in types, but it's also a discrepancy between the StateManagerProps type and the CreatableProps type.
The StateManagerProps (finally exported as Props) is now defined as:
export type StateManagerProps<
...
Group extends GroupBase<Option> = GroupBase<Option>
>
However, the CreatableProps is defined as:
export type CreatableProps<
...
Group extends GroupBase<Option>
>
That is, the generic Group doesn't have a default. This seems like an accidental omission. The CreatableSelect itself does have the default.
Giving the type default in the prop type as well would help to reduce a small amount of boilerplate, if you're composing on top of CreatableSelect, but don't care about the grouped options.
Would you like a PR for the fix? :)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in packages/react-select/src/Creatable.tsx and compare the CreatableProps generic declaration with StateManagerProps in packages/react-select/src/useStateManager.ts. Confirm the missing default for Group and verify that CreatableProps matches the existing defaulting pattern; the work is done when the type no longer requires boilerplate for the default group type.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100