slider icon indicating copy to clipboard operation
slider copied to clipboard

Change types of arrays on props to ReadonlyArray

Open lukeapage opened this issue 5 years ago • 3 comments

We use ReadonlyArray in typescript alot, but we get an error passing it to rc-slider, even though you do mutate the array. Changing it would only allow more types to be passed afaik. I can make a PR if you indicate this would be accepted.

lukeapage avatar Nov 02 '20 10:11 lukeapage

Can you provide reproduce example?

kerm1it avatar Nov 02 '20 11:11 kerm1it

The range props are just arrays: https://github.com/react-component/slider/blob/master/src/Range.tsx#L37 So e.g. (off the top of my head)

const values: ReadonlyArray<number> = [1,2];
return <Range values={values} />;

lukeapage avatar Nov 02 '20 12:11 lukeapage

@lukeapage Is there a typo in your original message, you do mutate instead of you don’t mutate, that might have confused the maintainers?

danyalaytekin avatar Aug 03 '22 08:08 danyalaytekin