Open
Description
Using react-scrollbars-custom with TypeScript what would be the correct implementation of the onScroll event?
Edit: I suspect there's some kind of namespace conflict happening between TypeScript's general definition for onScroll and the plugin; finding references for onScroll has two results, which reflects the error given at the bottom of this question, specifically not assignable to type '((event: UIEvent) => void) & ((scrollValues: ScrollValues, prevScrollValues: ScrollValues) => void)
import * as React from "react";
import { Scrollbar } from 'react-scrollbars-custom';
export default class App extends React.Component {
handleScroll = (scrollValues : ScrollValues, prevScrollValues : ScrollValues) => {
// ...
}
render() {
return <Scrollbar onScroll={this.handleScroll} style={{ position: "absolute", height:"100%", width:"100%" }}>
// ...
</Scrollbar>
}
}
This is the error message:
Error TS2322 (TS) Type '(scrollValues: ScrollValues, prevScrollValues: ScrollValues) => void' is not assignable to type '((event: UIEvent<HTMLElement>) => void) & ((scrollValues: ScrollValues, prevScrollValues: ScrollValues) => void)'.
Type '(scrollValues: ScrollValues, prevScrollValues: ScrollValues) => void' is not assignable to type '(event: UIEvent<HTMLElement>) => void'