Skip to content

Commit

Permalink
Fix(types): correct the type of outerRef and innerRef
Browse files Browse the repository at this point in the history
  • Loading branch information
wellyshen committed May 23, 2021
1 parent d0a9ddc commit b7480d0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/young-phones-happen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"react-cool-virtual": patch
---

Fix(types): correct the type of `outerRef` and `innerRef`
6 changes: 3 additions & 3 deletions src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RefObject } from "react";
import { MutableRefObject } from "react";

// Internal
export interface Measure {
Expand Down Expand Up @@ -101,8 +101,8 @@ export interface Options {
}

export interface Return<O, I> {
outerRef: RefObject<O>;
innerRef: RefObject<I>;
outerRef: MutableRefObject<O | null>;
innerRef: MutableRefObject<I | null>;
items: Item[];
scrollTo: ScrollTo;
scrollToItem: ScrollToItem;
Expand Down
6 changes: 3 additions & 3 deletions src/types/react-cool-virtual.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
declare module "react-cool-virtual" {
import { RefObject } from "react";
import { MutableRefObject } from "react";

export interface ItemSizeFunction {
(index: number, width: number): number;
Expand Down Expand Up @@ -104,8 +104,8 @@ declare module "react-cool-virtual" {
O extends HTMLElement = HTMLElement,
I extends HTMLElement = HTMLElement
> {
outerRef: RefObject<O>;
innerRef: RefObject<I>;
outerRef: MutableRefObject<O | null>;
innerRef: MutableRefObject<I | null>;
items: Item[];
scrollTo: ScrollTo;
scrollToItem: ScrollToItem;
Expand Down

0 comments on commit b7480d0

Please sign in to comment.