From 2d894883dc46b7475acb610bac0063eb45dcecd5 Mon Sep 17 00:00:00 2001 From: Maksim Sviridov Date: Thu, 24 Aug 2023 20:51:53 +0300 Subject: [PATCH 1/2] fix(ListView): typedef of component handlers fix(ListView): rename stories filename --- src/components/ListView.tsx | 4 ++-- src/stories/{ListItem.stories.tsx => ListView.stories.tsx} | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename src/stories/{ListItem.stories.tsx => ListView.stories.tsx} (95%) diff --git a/src/components/ListView.tsx b/src/components/ListView.tsx index 32b44ab2..badcd1bb 100644 --- a/src/components/ListView.tsx +++ b/src/components/ListView.tsx @@ -15,8 +15,8 @@ import { useMounted } from '../hooks/useMounted'; import { useKeyPress } from '../hooks'; interface ListViewProps { - onClick?: (value: T) => void; - onKeyboardClick?: (value: T) => void; + onClick?: (value: unknown) => void; + onKeyboardClick?: (value: unknown) => void; children: React.ReactNode; } diff --git a/src/stories/ListItem.stories.tsx b/src/stories/ListView.stories.tsx similarity index 95% rename from src/stories/ListItem.stories.tsx rename to src/stories/ListView.stories.tsx index 35c528c2..758f5349 100644 --- a/src/stories/ListItem.stories.tsx +++ b/src/stories/ListView.stories.tsx @@ -16,7 +16,7 @@ const data = Array.from({ length: 10 }, (_, i) => ({ export const Default: StoryFn = () => { return ( - + console.log(item)} onKeyboardClick={(item) => console.log(item)}> {data.slice(0, 5).map((item) => ( Date: Thu, 24 Aug 2023 23:52:19 +0200 Subject: [PATCH 2/2] chore(ListView): any is valid type for item value --- src/components/ListView.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/ListView.tsx b/src/components/ListView.tsx index badcd1bb..f0dddb2d 100644 --- a/src/components/ListView.tsx +++ b/src/components/ListView.tsx @@ -15,8 +15,10 @@ import { useMounted } from '../hooks/useMounted'; import { useKeyPress } from '../hooks'; interface ListViewProps { - onClick?: (value: unknown) => void; - onKeyboardClick?: (value: unknown) => void; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + onClick?: (value: any) => void; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + onKeyboardClick?: (value: any) => void; children: React.ReactNode; }