From 41161e8705cae03f1020e008707d56ab7f89fb3d Mon Sep 17 00:00:00 2001 From: Alexander K Date: Fri, 6 Aug 2021 16:03:33 +0300 Subject: [PATCH 1/2] move options interface definition to separated interface and export it --- types/index.d.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index 5cfcc3e1..21106ec9 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -22,9 +22,7 @@ export interface Range { size: number } -declare function defaultRangeExtractor(range: Range): number[] - -declare function useVirtual(options: { +export interface ReactVirtualOptions { size: number parentRef: React.RefObject estimateSize?: (index: number) => number @@ -47,7 +45,11 @@ declare function useVirtual(options: { onScrollElement?: React.RefObject scrollOffsetFn?: (event?: Event) => number rangeExtractor?: (range: Range) => number[] -}): { +} + +declare function defaultRangeExtractor(range: Range): number[] + +declare function useVirtual(options: ReactVirtualOptions): { virtualItems: VirtualItem[] totalSize: number scrollToOffset: (index: number, options?: ScrollToOffsetOptions) => void From bce1623e2cfbc6ca3741ba7150d611c7c79552c5 Mon Sep 17 00:00:00 2001 From: Alexander K Date: Fri, 6 Aug 2021 18:12:52 +0300 Subject: [PATCH 2/2] fix issue with type peram, rename interface --- types/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index 21106ec9..8cc2de8f 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -22,7 +22,7 @@ export interface Range { size: number } -export interface ReactVirtualOptions { +export interface Options { size: number parentRef: React.RefObject estimateSize?: (index: number) => number @@ -49,7 +49,7 @@ export interface ReactVirtualOptions { declare function defaultRangeExtractor(range: Range): number[] -declare function useVirtual(options: ReactVirtualOptions): { +declare function useVirtual(options: Options): { virtualItems: VirtualItem[] totalSize: number scrollToOffset: (index: number, options?: ScrollToOffsetOptions) => void