I am trying to figure out how to get this code to work on TypeScript
type ScrollProps = {
autoHide: boolean
autoHideTimeout: number
autoHideDuration: number
}
const renderThumb = ({ style, ...props}) => {
const thumbStyle = {
borderRadius: 6,
backgroundColor: 'rgba(35, 49, 86, 0.8)'
}
return <div style={{ ...style, ...thumbStyle }} {...props} />
}
const CustomScrollbars = (props: ScrollProps) => (
<Scrollbars
renderThumbHorizontal={renderThumb}
renderThumbVertical={renderThumb}
{...props}
/>
)
...
<CustomScrollbars autoHide autoHideTimeout={500} autoHideDuration={200}>
...
</CustomScrollbars>
If I create a type for the props on CustomScrollbars I get an error on <CustomScrollbars>, if I don't I get an error on the props at the CustomScrollbars function.
I also get an error on style, it wants to know what type, but I do not know what type to put.
Why does the implicit any not work and how can I make this code to work on TypeScript?
https://codesandbox.io/s/react-hooks-with-typescript-forked-8g5g6