react-select icon indicating copy to clipboard operation
react-select copied to clipboard

TypeScript types: Group does not default to GroupBase<Option> in CreatableProps

Open synchronos-t opened this issue 11 months ago • 0 comments

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? :)

synchronos-t avatar Feb 27 '25 10:02 synchronos-t