zillow / react-slider

Accessible, CSS agnostic, slider component for React.
https://zillow.github.io/react-slider
MIT License
883 stars 231 forks source link

Typescript issue #290

Open haiderhossain10 opened 1 year ago

haiderhossain10 commented 1 year ago

When i use defaultValue={[0, 10000]} then getting error in typescript. How can i solve it?

Image Link

drwpow commented 10 months ago

The problem is in the DefinitelyTyped package, not this repo. If possible, you can try and declare a generic for ReactSliderProps, e.g.

import { ReactSliderProps } from 'react-slider';

const props: ReactSliderProps<number[]> = {
  defaultValue: [0, 100],
}

<ReactSlider defaultValue={props.defaultValue} />