Skip to content

Commit 032711e

Browse files
committed
minor typing improvement
1 parent 71ef76e commit 032711e

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

apps/demo/src/components/infinite-list-with-reverse-horizontal-scroll.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export function InfiniteListWithReverseHozirontalScroll() {
1414
rootMargin: '0px 0px 0px 400px',
1515
});
1616

17-
const scrollableRootRef = useRef<React.ElementRef<'div'> | null>(null);
17+
const scrollableRootRef = useRef<React.ComponentRef<'div'> | null>(null);
1818
const lastScrollDistanceToRightRef = useRef<number>();
1919

2020
const reversedItems = useMemo(() => [...items].reverse(), [items]);

apps/demo/src/components/infinite-list-with-reverse-vertical-scroll.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export function InfiniteListWithReverseVerticalScroll() {
1414
rootMargin: '400px 0px 0px 0px',
1515
});
1616

17-
const scrollableRootRef = useRef<React.ElementRef<'div'> | null>(null);
17+
const scrollableRootRef = useRef<React.ComponentRef<'div'> | null>(null);
1818
const lastScrollDistanceToBottomRef = useRef<number>();
1919

2020
const reversedItems = useMemo(() => [...items].reverse(), [items]);

apps/demo/src/components/list.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { forwardRef } from 'react';
22

3-
type ListProps = React.PropsWithChildren & {
3+
type ListProps = {
44
direction?: 'vertical' | 'horizontal';
5+
children: React.ReactNode;
56
};
67

78
export function List({ direction, ...rest }: ListProps) {
@@ -13,9 +14,11 @@ export function List({ direction, ...rest }: ListProps) {
1314
);
1415
}
1516

16-
type ListItemProps = React.PropsWithChildren;
17+
type ListItemProps = {
18+
children: React.ReactNode;
19+
};
1720

18-
export const ListItem = forwardRef<React.ElementRef<'li'>, ListItemProps>(
21+
export const ListItem = forwardRef<React.ComponentRef<'li'>, ListItemProps>(
1922
function ListItem(props, ref) {
2023
return <li ref={ref} className="m-1 border bg-slate-200 p-2" {...props} />;
2124
},

0 commit comments

Comments
 (0)