From fd431d338c9c49eeba92f07d2a5606bb75695553 Mon Sep 17 00:00:00 2001 From: liaoxuezhi <2betop.cn@gmail.com> Date: Tue, 18 Aug 2020 23:28:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=88=20any=20=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/virtual-list/index.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/virtual-list/index.tsx b/src/components/virtual-list/index.tsx index 6f527be7..099e8af1 100644 --- a/src/components/virtual-list/index.tsx +++ b/src/components/virtual-list/index.tsx @@ -141,7 +141,7 @@ export default class VirtualList extends React.PureComponent { }; itemSizeGetter = (itemSize: Props['itemSize']) => { - return index => this.getSize(index, itemSize); + return (index: any) => this.getSize(index, itemSize); }; sizeAndPositionManager = new SizeAndPositionManager({ @@ -275,7 +275,7 @@ export default class VirtualList extends React.PureComponent { scrollTo(value: number) { const {scrollDirection = DIRECTION.VERTICAL} = this.props; - this.rootNode[scrollProp[scrollDirection]] = value; + (this.rootNode as any)[scrollProp[scrollDirection]] = value; } getOffsetForIndex( @@ -291,7 +291,7 @@ export default class VirtualList extends React.PureComponent { return this.sizeAndPositionManager.getUpdatedOffsetForIndex({ align: scrollToAlignment, - containerSize: this.props[sizeProp[scrollDirection]], + containerSize: this.props[sizeProp[scrollDirection] as 'scrollOffset']!, currentOffset: (this.state && this.state.offset) || 0, targetIndex: index }); @@ -323,7 +323,7 @@ export default class VirtualList extends React.PureComponent { } = this.props; const {offset} = this.state; const {start, stop} = this.sizeAndPositionManager.getVisibleRange({ - containerSize: this.props[sizeProp[scrollDirection]] || 0, + containerSize: (this as any).props[sizeProp[scrollDirection]] || 0, offset, overscanCount }); @@ -407,7 +407,7 @@ export default class VirtualList extends React.PureComponent { private getNodeOffset() { const {scrollDirection = DIRECTION.VERTICAL} = this.props; - return this.rootNode[scrollProp[scrollDirection]]; + return (this as any).rootNode[scrollProp[scrollDirection]]; } private getEstimatedItemSize(props = this.props) { @@ -418,7 +418,7 @@ export default class VirtualList extends React.PureComponent { ); } - private getSize(index: number, itemSize) { + private getSize(index: number, itemSize: any) { if (typeof itemSize === 'function') { return itemSize(index); }