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]; } }