Assert type of domNode as HTMLElement to fix build

Signed-off-by: Sergey Shpikin <rkfg@rkfg.me>
pull/21833/head
Sergey Shpikin 2020-04-22 21:42:43 +03:00
parent 2952c37a47
commit ae3dcff230
1 changed files with 1 additions and 1 deletions

View File

@ -259,7 +259,7 @@ export default class Autocomplete extends React.PureComponent<IProps, IState> {
const selectedCompletion = this.refs[`completion${this.state.selectionOffset}`]; const selectedCompletion = this.refs[`completion${this.state.selectionOffset}`];
if (selectedCompletion && this.containerRef.current) { if (selectedCompletion && this.containerRef.current) {
const domNode = ReactDOM.findDOMNode(selectedCompletion); const domNode = ReactDOM.findDOMNode(selectedCompletion);
const offsetTop = domNode && domNode.offsetTop; const offsetTop = domNode && (domNode as HTMLElement).offsetTop;
if (offsetTop > this.containerRef.current.scrollTop + this.containerRef.current.offsetHeight || if (offsetTop > this.containerRef.current.scrollTop + this.containerRef.current.offsetHeight ||
offsetTop < this.containerRef.current.scrollTop) { offsetTop < this.containerRef.current.scrollTop) {
this.containerRef.current.scrollTop = offsetTop - this.containerRef.current.offsetTop; this.containerRef.current.scrollTop = offsetTop - this.containerRef.current.offsetTop;