[Slider] Allow generic value type to narrow onChange value type #37854
Labels
component: slider
This is the name of the generic UI component, not the React module!
enhancement
This is not a bug, nor a new feature
ready to take
Help wanted. Guidance available. There is a high chance the change will be accepted
typescript
waiting for 👍
Waiting for upvotes
Milestone
Duplicates
Latest version
Summary 💡
Giving a
number
type as value should narrowonChange
value param tonumber
, and giving anumber[]
type as value should narrowonChange
value param tonumber[]
Examples 🌈
<Slider value={1} onChange={(e, value:number) => {}} />
<Slider value={[1,2]} onChange={(e, value:number[]) => {}} />
Motivation 🔦
We currently have to do something like this
<Slider value={1} onChange{(e, value) => typeof value === 'number' ? ... : ...what do i do here? throw an error? } />
to make typescript happyThe text was updated successfully, but these errors were encountered: