chakra-react-select: [BUG] `selectedOptionStyle` and `variant` are missing from `Select` types.

Description

selectedOptionStyle and variant are missing from types. It is passed to component itself, but causing type error.

As a temporary solution i had to thow // @ts-expect-error to silnce typescipt.

For the variant TS error is: Property  variant  does not exist on type 'IntrinsicAttributes & Omit<PublicBaseSelectProps<{ value: string; label: string; }, true, { label: string; options: { value: string; label: string; }[]; }>, StateManagedPropKeys> & Partial<...> & StateManagerAdditionalProps<...> & RefAttributes<...>'.

For the selectedOptionStyle is: Property  selectedOptionStyle  does not exist on type 'IntrinsicAttributes & Omit<PublicBaseSelectProps<{ value: string; label: string; }, true, { label: string; options: { value: string; label: string; }[]; }>, StateManagedPropKeys> & Partial<...> & StateManagerAdditionalProps<...> & RefAttributes<...>'.

chakra-react-select Version

4.7.0

Link to Reproduction

No response

TypeScript?

  • Yes I use TypeScript

Steps to reproduce

  1. Try to use selectedOptionStyle or variant props on Select component

Operating System

  • macOS
  • Windows
  • Linux
  • iOS/iPadOS
  • Android

Additional Information

"typescript": "^5.1.6"

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 1
  • Comments: 16 (10 by maintainers)

Most upvoted comments

So I decided that this issue is more important than being on the latest version of react-select so I pushed a new version of this package that relies on a lower version. I’m not too worried about this as they’re only a few patch versions ahead of the version required for this to work properly, and I will re-upgrade once my PR is merged in to react-select and keep you all updated here when when that happens. See the PR linked above for the full explanation.

@Joeao Aah ok, that would make sense! Thanks for looking further into it, that gives me more confidence that my PR should fix the issue.

Ok, there has been an update! The maintainers of react-select responded to my pull request and were able to give an alternative approach to the module augmentation that doesn’t rely on augmenting the internal declaration files: https://github.com/JedWatson/react-select/pull/5762#issuecomment-1762700437

This is what their docs had recommended previously, which is why I hadn’t realized this approach was possible. Anyway, a real fix has been published in v4.7.5, so if you were having issues with this, please try out the new version and let me know if you’re still having any problems!