Unable to type onSelect prop for Select correctly
See original GitHub issue- I have searched the issues of this repository and believe that this is not a duplicate.
Reproduction link
Steps to reproduce
Add an onSelect prop to a <Select />
when using typescript.
What is expected?
That I am able to get proper types for the onSelect callback parameters.
What is actually happening?
both arguments get implicitly typed as any, even when trying to use the generics syntax <Select<ValueType, OptionType>></Select>
, this syntax does however seem to apply to the filterOption callback which does get its params typed based on ValueType and OptionType.
Environment | Info |
---|---|
antd | 4.18.8 |
React | react 17.0.2 |
System | windows 10 |
Browser | n/a |
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Typescript React <Select> onChange handler type error
Since MUI Select in not a real select element you will need to cast e.target.value using as Type and type the handler as...
Read more >Unable to type in Input field issue in React [Solved] | bobbyhadz
The problem is that the input field has a value prop set, but it doesn't have an onChange prop that handles changes of...
Read more >TypeScript - React Select
A flexible and beautiful Select Input control for ReactJS with multiselect ... If TypeScript can't detect what type this should be, it defaults...
Read more >Accessibility - React
Keyboard focus and focus outline. Keyboard focus refers to the current element in the DOM that is selected to accept input from the...
Read more >useForm - register - Simple React forms validation
This method allows you to register an input or select element and apply validation rules to React ... onChange prop to subscribe the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@DBSDs sure
can i work on this?