Added definitions required to override getParentElement (#29317)

This commit is contained in:
WrathZA 2018-10-08 19:22:08 +02:00 committed by Andy
parent 29d283ca5c
commit bfa300406a
2 changed files with 17 additions and 1 deletions

View File

@ -2,6 +2,7 @@
// Project: https://github.com/CassetteRocks/react-infinite-scroller
// Definitions by: Lauri Lavanti <https://github.com/Lapanti>,
// Piotr Srebniak <https://github.com/psrebniak>
// Brett Miller <https://github.com/WrathZA>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
@ -62,7 +63,9 @@ declare namespace InfiniteScroll {
*/
loader?: React.ReactElement<any>;
}
class InfiniteScroll extends React.Component<InfiniteScrollProps> { }
class InfiniteScroll extends React.Component<InfiniteScrollProps> {
getParentElement(elem?: HTMLElement | null): HTMLElement | undefined | null;
}
namespace InfiniteScroll {}
}

View File

@ -32,3 +32,16 @@ class Test2 extends React.Component {
);
}
}
class InfiniteScrollOverride extends InfiniteScroll {
getParentElement(el: HTMLElement) {
if (document.getElementById("scroll-header")) {
return document.getElementById("scroll-header");
}
return super.getParentElement(el);
}
render() {
return super.render();
}
}