From 24a0a764833343508ca93dc2dd53c2614f89dfc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E6=9C=BA=E5=99=A8=E4=BA=BA?= Date: Tue, 19 Sep 2023 17:50:09 +0800 Subject: [PATCH] chore: fix ts --- src/List.tsx | 2 +- src/utils/CacheMap.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/List.tsx b/src/List.tsx index d71db85c..9b6d892b 100644 --- a/src/List.tsx +++ b/src/List.tsx @@ -134,7 +134,7 @@ export function RawList(props: ListProps, ref: React.Ref) { if (typeof itemKey === 'function') { return itemKey(item); } - return item?.[itemKey]; + return item?.[itemKey as string]; }, [itemKey], ); diff --git a/src/utils/CacheMap.ts b/src/utils/CacheMap.ts index 5de321ba..a428bbb4 100644 --- a/src/utils/CacheMap.ts +++ b/src/utils/CacheMap.ts @@ -13,12 +13,12 @@ class CacheMap { } set(key: React.Key, value: number) { - this.maps[key] = value; + this.maps[key as string] = value; this.id += 1; } get(key: React.Key) { - return this.maps[key]; + return this.maps[key as string]; } }