From e00580d84e4c59fb87c3cfe591ef07afc103ef50 Mon Sep 17 00:00:00 2001 From: Alex Junior Date: Tue, 22 Mar 2022 11:16:41 -0300 Subject: [PATCH] Chore: Clean ThreadDetails - TypeScript (#3924) --- app/containers/ThreadDetails.tsx | 14 +++++++------- app/views/ThreadMessagesView/Item.tsx | 7 +++---- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/app/containers/ThreadDetails.tsx b/app/containers/ThreadDetails.tsx index 2edb451e8..92f2aa9c2 100644 --- a/app/containers/ThreadDetails.tsx +++ b/app/containers/ThreadDetails.tsx @@ -41,7 +41,7 @@ const styles = StyleSheet.create({ }); interface IThreadDetails { - item: Partial; + item: Pick; user: { id: string; }; @@ -62,21 +62,21 @@ const ThreadDetails = ({ item, user, badgeColor, toggleFollowThread, style }: IT replies = '+999'; } - const isFollowing = item.replies?.find((u: any) => u === user?.id); + const isFollowing = item.replies?.find((u: string) => u === user?.id); return ( - - + + {count} - - + + {replies} @@ -87,7 +87,7 @@ const ThreadDetails = ({ item, user, badgeColor, toggleFollowThread, style }: IT diff --git a/app/views/ThreadMessagesView/Item.tsx b/app/views/ThreadMessagesView/Item.tsx index b7453f011..82441c43e 100644 --- a/app/views/ThreadMessagesView/Item.tsx +++ b/app/views/ThreadMessagesView/Item.tsx @@ -70,7 +70,6 @@ const Item = ({ item, useRealName, user, badgeColor, onPress, toggleFollowThread const username = (useRealName && item?.u?.name) || item?.u?.username; let time; if (item?.ts) { - // @ts-ignore TODO: to be fixed after we unify our types time = formatDateThreads(item.ts); } @@ -78,15 +77,15 @@ const Item = ({ item, useRealName, user, badgeColor, onPress, toggleFollowThread onPress(item)} testID={`thread-messages-view-${item.msg}`} - style={{ backgroundColor: themes[theme!].backgroundColor }}> + style={{ backgroundColor: themes[theme].backgroundColor }}> - + {username} - {time} + {time}