From 6609133ca9dd0259087970c76472978a37818112 Mon Sep 17 00:00:00 2001 From: Atul Madhugiri Date: Thu, 9 Nov 2023 14:45:46 -0500 Subject: [PATCH] [lib] Use `RawThreadInfos` type everywhere Summary: In some places we were using `RawThreadInfos`, in others we were using `{ +[id: string]: RawThreadInfo }`, and in others we were using `{ +[threadID: string]: RawThreadInfo }`. This is just for convenience when refactoring. Searching for `RawThreadInfos` or using "go to usages" will actually show us all uses of this type: https://blob.sh/68308a.png Test Plan: NA Reviewers: ashoat, ginsu, tomek, rohan Reviewed By: ashoat Subscribers: wyilio Differential Revision: https://phab.comm.dev/D9787 --- keyserver/src/creators/update-creator.js | 4 ++-- lib/actions/user-actions.js | 4 ++-- lib/ops/thread-store-ops.js | 3 ++- lib/reducers/calendar-filters-reducer.js | 4 ++-- lib/reducers/entry-reducer.js | 6 +++--- lib/reducers/message-reducer.js | 14 +++++++------- lib/reducers/thread-reducer.js | 4 ++-- lib/selectors/thread-selectors.js | 19 ++++++++++--------- lib/types/account-types.js | 10 +++++----- lib/types/report-types.js | 12 ++++++------ lib/types/session-types.js | 6 +++--- lib/types/socket-types.js | 4 ++-- lib/types/thread-types.js | 4 ++-- .../redux/edit-thread-permission-migration.js | 3 ++- .../redux/manage-pins-permission-migration.js | 3 ++- native/selectors/message-selectors.js | 4 ++-- web/redux/nav-reducer.js | 4 ++-- web/selectors/thread-selectors.js | 7 ++----- 18 files changed, 58 insertions(+), 57 deletions(-) diff --git a/keyserver/src/creators/update-creator.js b/keyserver/src/creators/update-creator.js index 2229c54407..b78235dcde 100644 --- a/keyserver/src/creators/update-creator.js +++ b/keyserver/src/creators/update-creator.js @@ -26,7 +26,7 @@ import { redisMessageTypes, type NewUpdatesRedisMessage, } from 'lib/types/redis-types.js'; -import type { RawThreadInfo } from 'lib/types/thread-types.js'; +import type { RawThreadInfos } from 'lib/types/thread-types'; import { type ServerUpdateInfo, type UpdateData, @@ -84,7 +84,7 @@ export type ViewerInfo = viewer: Viewer, calendarQuery: ?CalendarQuery, updatesForCurrentSession?: UpdatesForCurrentSession, - threadInfos: { +[id: string]: RawThreadInfo }, + threadInfos: RawThreadInfos, }; const defaultUpdateCreationResult = { viewerUpdates: [], userInfos: {} }; const sortFunction = ( diff --git a/lib/actions/user-actions.js b/lib/actions/user-actions.js index d39a7f8766..a07cd3b001 100644 --- a/lib/actions/user-actions.js +++ b/lib/actions/user-actions.js @@ -32,7 +32,7 @@ import type { SubscriptionUpdateRequest, SubscriptionUpdateResult, } from '../types/subscription-types.js'; -import type { RawThreadInfo } from '../types/thread-types'; +import type { RawThreadInfos } from '../types/thread-types'; import type { UserInfo, PasswordUpdate, @@ -245,7 +245,7 @@ const logIn = const userInfosArrays = []; - let threadInfos: { +[id: string]: RawThreadInfo } = {}; + let threadInfos: RawThreadInfos = {}; const calendarResult = { calendarQuery: logInInfo.calendarQuery, rawEntryInfos: [], diff --git a/lib/ops/thread-store-ops.js b/lib/ops/thread-store-ops.js index e83f7c6004..26dbbc383b 100644 --- a/lib/ops/thread-store-ops.js +++ b/lib/ops/thread-store-ops.js @@ -4,6 +4,7 @@ import { type BaseStoreOpsHandlers } from './base-ops.js'; import type { ClientDBThreadInfo, RawThreadInfo, + RawThreadInfos, ThreadStore, } from '../types/thread-types.js'; import { @@ -44,7 +45,7 @@ export const threadStoreOpsHandlers: BaseStoreOpsHandlers< ThreadStore, ThreadStoreOperation, ClientDBThreadStoreOperation, - { +[id: string]: RawThreadInfo }, + RawThreadInfos, ClientDBThreadInfo, > = { processStoreOperations( diff --git a/lib/reducers/calendar-filters-reducer.js b/lib/reducers/calendar-filters-reducer.js index cbf2fb07e5..25f1501cb8 100644 --- a/lib/reducers/calendar-filters-reducer.js +++ b/lib/reducers/calendar-filters-reducer.js @@ -37,7 +37,7 @@ import { fullStateSyncActionType, incrementalStateSyncActionType, } from '../types/socket-types.js'; -import type { RawThreadInfo, ThreadStore } from '../types/thread-types.js'; +import type { RawThreadInfos, ThreadStore } from '../types/thread-types.js'; import { type ClientUpdateInfo, processUpdatesActionType, @@ -158,7 +158,7 @@ function updateFilterListFromUpdateInfos( function removeDeletedThreadIDsFromFilterList( state: $ReadOnlyArray, - threadInfos: { +[id: string]: RawThreadInfo }, + threadInfos: RawThreadInfos, ): $ReadOnlyArray { const currentlyFilteredIDs = filteredThreadIDs(state); if (!currentlyFilteredIDs) { diff --git a/lib/reducers/entry-reducer.js b/lib/reducers/entry-reducer.js index 27e669e9c7..8f43d34a15 100644 --- a/lib/reducers/entry-reducer.js +++ b/lib/reducers/entry-reducer.js @@ -54,7 +54,7 @@ import { fullStateSyncActionType, incrementalStateSyncActionType, } from '../types/socket-types.js'; -import { type RawThreadInfo } from '../types/thread-types.js'; +import { type RawThreadInfos } from '../types/thread-types.js'; import { type ClientUpdateInfo, processUpdatesActionType, @@ -90,7 +90,7 @@ function mergeNewEntryInfos( currentEntryInfos: { +[id: string]: RawEntryInfo }, currentDaysToEntries: ?{ +[day: string]: string[] }, newEntryInfos: $ReadOnlyArray, - threadInfos: { +[id: string]: RawThreadInfo }, + threadInfos: RawThreadInfos, ) { const mergedEntryInfos = {}; let someEntryUpdated = false; @@ -163,7 +163,7 @@ function mergeNewEntryInfos( function reduceEntryInfos( entryStore: EntryStore, action: BaseAction, - newThreadInfos: { +[id: string]: RawThreadInfo }, + newThreadInfos: RawThreadInfos, ): [EntryStore, $ReadOnlyArray] { const { entryInfos, daysToEntries, lastUserInteractionCalendar } = entryStore; if ( diff --git a/lib/reducers/message-reducer.js b/lib/reducers/message-reducer.js index 005a052f0a..37d62c5fe6 100644 --- a/lib/reducers/message-reducer.js +++ b/lib/reducers/message-reducer.js @@ -93,7 +93,7 @@ import { incrementalStateSyncActionType, } from '../types/socket-types.js'; import { threadPermissions } from '../types/thread-permission-types.js'; -import { type RawThreadInfo } from '../types/thread-types.js'; +import type { RawThreadInfo, RawThreadInfos } from '../types/thread-types.js'; import { type ClientUpdateInfo, processUpdatesActionType, @@ -146,7 +146,7 @@ function freshMessageStore( messageInfos: $ReadOnlyArray, truncationStatus: { [threadID: string]: MessageTruncationStatus }, currentAsOf: number, - threadInfos: { +[threadID: string]: RawThreadInfo }, + threadInfos: RawThreadInfos, ): FreshMessageStoreResult { const unshimmed = unshimMessageInfos(messageInfos); const orderedMessageInfos = sortMessageInfoList(unshimmed); @@ -212,7 +212,7 @@ type ReassignmentResult = { function reassignMessagesToRealizedThreads( messageStore: MessageStore, - threadInfos: { +[threadID: string]: RawThreadInfo }, + threadInfos: RawThreadInfos, ): ReassignmentResult { const pendingToRealizedThreadIDs = pendingToRealizedThreadIDsSelector(threadInfos); @@ -305,7 +305,7 @@ function mergeNewMessages( oldMessageStore: MessageStore, newMessageInfos: $ReadOnlyArray, truncationStatus: { [threadID: string]: MessageTruncationStatus }, - threadInfos: { +[threadID: string]: RawThreadInfo }, + threadInfos: RawThreadInfos, ): MergeNewMessagesResult { const { messageStoreOperations: updateWithLatestThreadInfosOps, @@ -623,7 +623,7 @@ type UpdateMessageStoreWithLatestThreadInfosResult = { }; function updateMessageStoreWithLatestThreadInfos( messageStore: MessageStore, - threadInfos: { +[id: string]: RawThreadInfo }, + threadInfos: RawThreadInfos, ): UpdateMessageStoreWithLatestThreadInfosResult { const messageStoreOperations: MessageStoreOperation[] = []; const { @@ -691,7 +691,7 @@ function updateMessageStoreWithLatestThreadInfos( function ensureRealizedThreadIDIsUsedWhenPossible( payload: T, - threadInfos: { +[id: string]: RawThreadInfo }, + threadInfos: RawThreadInfos, ): T { const pendingToRealizedThreadIDs = pendingToRealizedThreadIDsSelector(threadInfos); @@ -711,7 +711,7 @@ type ReduceMessageStoreResult = { function reduceMessageStore( messageStore: MessageStore, action: BaseAction, - newThreadInfos: { +[id: string]: RawThreadInfo }, + newThreadInfos: RawThreadInfos, ): ReduceMessageStoreResult { if ( action.type === logInActionTypes.success || diff --git a/lib/reducers/thread-reducer.js b/lib/reducers/thread-reducer.js index c666786f0b..0e0b7958b7 100644 --- a/lib/reducers/thread-reducer.js +++ b/lib/reducers/thread-reducer.js @@ -41,7 +41,7 @@ import { fullStateSyncActionType, incrementalStateSyncActionType, } from '../types/socket-types.js'; -import type { RawThreadInfo, ThreadStore } from '../types/thread-types.js'; +import type { RawThreadInfos, ThreadStore } from '../types/thread-types.js'; import { type ClientUpdateInfo, processUpdatesActionType, @@ -52,7 +52,7 @@ const { processStoreOperations: processThreadStoreOperations } = threadStoreOpsHandlers; function generateOpsForThreadUpdates( - threadInfos: { +[id: string]: RawThreadInfo }, + threadInfos: RawThreadInfos, payload: { +updatesResult: { +newUpdates: $ReadOnlyArray, ... }, ... diff --git a/lib/selectors/thread-selectors.js b/lib/selectors/thread-selectors.js index 53ade46fdb..9da38029cf 100644 --- a/lib/selectors/thread-selectors.js +++ b/lib/selectors/thread-selectors.js @@ -51,6 +51,7 @@ import { type RawThreadInfo, type RelativeMemberInfo, type SidebarInfo, + type RawThreadInfos, } from '../types/thread-types.js'; import { dateString, dateFromString } from '../utils/date-utils.js'; import { values } from '../utils/objects.js'; @@ -273,7 +274,7 @@ const sidebarInfoSelector: (state: BaseAppState<>) => { const unreadCount: (state: BaseAppState<>) => number = createSelector( (state: BaseAppState<>) => state.threadStore.threadInfos, - (threadInfos: { +[id: string]: RawThreadInfo }): number => + (threadInfos: RawThreadInfos): number => values(threadInfos).filter( threadInfo => threadInHomeChatList(threadInfo) && threadInfo.currentUser.unread, @@ -282,7 +283,7 @@ const unreadCount: (state: BaseAppState<>) => number = createSelector( const unreadBackgroundCount: (state: BaseAppState<>) => number = createSelector( (state: BaseAppState<>) => state.threadStore.threadInfos, - (threadInfos: { +[id: string]: RawThreadInfo }): number => + (threadInfos: RawThreadInfos): number => values(threadInfos).filter( threadInfo => threadInBackgroundChatList(threadInfo) && threadInfo.currentUser.unread, @@ -351,7 +352,7 @@ const otherUsersButNoOtherAdmins: ( function mostRecentlyReadThread( messageStore: MessageStore, - threadInfos: { +[id: string]: RawThreadInfo }, + threadInfos: RawThreadInfos, ): ?string { let mostRecent = null; for (const threadID in threadInfos) { @@ -393,7 +394,7 @@ const threadInfoFromSourceMessageIDSelector: (state: BaseAppState<>) => { (state: BaseAppState<>) => state.threadStore.threadInfos, threadInfoSelector, ( - rawThreadInfos: { +[id: string]: RawThreadInfo }, + rawThreadInfos: RawThreadInfos, threadInfos: { +[id: string]: ThreadInfo }, ) => { const pendingToRealizedThreadIDs = @@ -408,11 +409,11 @@ const threadInfoFromSourceMessageIDSelector: (state: BaseAppState<>) => { return result; }, ); -const pendingToRealizedThreadIDsSelector: (rawThreadInfos: { - +[id: string]: RawThreadInfo, -}) => $ReadOnlyMap = createSelector( - (rawThreadInfos: { +[id: string]: RawThreadInfo }) => rawThreadInfos, - (rawThreadInfos: { +[id: string]: RawThreadInfo }) => { +const pendingToRealizedThreadIDsSelector: ( + rawThreadInfos: RawThreadInfos, +) => $ReadOnlyMap = createSelector( + (rawThreadInfos: RawThreadInfos) => rawThreadInfos, + (rawThreadInfos: RawThreadInfos) => { const result = new Map(); for (const threadID in rawThreadInfos) { const rawThreadInfo = rawThreadInfos[threadID]; diff --git a/lib/types/account-types.js b/lib/types/account-types.js index 94607784f2..ca69406b23 100644 --- a/lib/types/account-types.js +++ b/lib/types/account-types.js @@ -15,7 +15,7 @@ import { type GenericMessagesResult, } from './message-types.js'; import type { PreRequestUserState } from './session-types.js'; -import { type RawThreadInfo } from './thread-types.js'; +import { type RawThreadInfos } from './thread-types.js'; import { type UserInfo, type LoggedOutUserInfo, @@ -69,7 +69,7 @@ export type RegisterResponse = { rawMessageInfos: $ReadOnlyArray, currentUserInfo: LoggedInUserInfo, cookieChange: { - threadInfos: { +[id: string]: RawThreadInfo }, + threadInfos: RawThreadInfos, userInfos: $ReadOnlyArray, }, }; @@ -77,7 +77,7 @@ export type RegisterResponse = { export type RegisterResult = { +currentUserInfo: LoggedInUserInfo, +rawMessageInfos: $ReadOnlyArray, - +threadInfos: { +[id: string]: RawThreadInfo }, + +threadInfos: RawThreadInfos, +userInfos: $ReadOnlyArray, +calendarQuery: CalendarQuery, }; @@ -142,14 +142,14 @@ export type LogInResponse = { +rawEntryInfos?: ?$ReadOnlyArray, +serverTime: number, +cookieChange: { - +threadInfos: { +[id: string]: RawThreadInfo }, + +threadInfos: RawThreadInfos, +userInfos: $ReadOnlyArray, }, +notAcknowledgedPolicies?: $ReadOnlyArray, }; export type LogInResult = { - +threadInfos: { +[id: string]: RawThreadInfo }, + +threadInfos: RawThreadInfos, +currentUserInfo: LoggedInUserInfo, +messagesResult: GenericMessagesResult, +userInfos: $ReadOnlyArray, diff --git a/lib/types/report-types.js b/lib/types/report-types.js index 5d6f78a117..3bce5ee90a 100644 --- a/lib/types/report-types.js +++ b/lib/types/report-types.js @@ -7,7 +7,7 @@ import { type PlatformDetails } from './device-types.js'; import { type RawEntryInfo, type CalendarQuery } from './entry-types.js'; import { type MediaMission } from './media-types.js'; import type { AppState, BaseAction } from './redux-types.js'; -import { type RawThreadInfo } from './thread-types.js'; +import { type RawThreadInfos } from './thread-types.js'; import type { UserInfo, UserInfos } from './user-types.js'; import { tPlatformDetails, tShape } from '../utils/validation-utils.js'; @@ -71,10 +71,10 @@ export type ActionSummary = { }; export type ThreadInconsistencyReportShape = { +platformDetails: PlatformDetails, - +beforeAction: { +[id: string]: RawThreadInfo }, + +beforeAction: RawThreadInfos, +action: BaseAction, - +pollResult?: { +[id: string]: RawThreadInfo }, - +pushResult: { +[id: string]: RawThreadInfo }, + +pollResult?: RawThreadInfos, + +pushResult: RawThreadInfos, +lastActionTypes?: $ReadOnlyArray<$PropertyType>, +lastActions?: $ReadOnlyArray, +time?: number, @@ -142,9 +142,9 @@ export type ReportCreationRequest = export type ClientThreadInconsistencyReportShape = { +platformDetails: PlatformDetails, - +beforeAction: { +[id: string]: RawThreadInfo }, + +beforeAction: RawThreadInfos, +action: BaseAction, - +pushResult: { +[id: string]: RawThreadInfo }, + +pushResult: RawThreadInfos, +lastActions: $ReadOnlyArray, +time: number, }; diff --git a/lib/types/session-types.js b/lib/types/session-types.js index dacb8dda0f..391ed43fb9 100644 --- a/lib/types/session-types.js +++ b/lib/types/session-types.js @@ -5,7 +5,7 @@ import t, { type TInterface } from 'tcomb'; import type { LogInActionSource } from './account-types.js'; import type { Shape } from './core.js'; import type { CalendarQuery } from './entry-types.js'; -import type { RawThreadInfo } from './thread-types.js'; +import type { RawThreadInfos } from './thread-types.js'; import { type UserInfo, type CurrentUserInfo, @@ -53,14 +53,14 @@ export type CookieType = $Values; export type ServerSessionChange = | { cookieInvalidated: false, - threadInfos: { +[id: string]: RawThreadInfo }, + threadInfos: RawThreadInfos, userInfos: $ReadOnlyArray, sessionID?: null | string, cookie?: string, } | { cookieInvalidated: true, - threadInfos: { +[id: string]: RawThreadInfo }, + threadInfos: RawThreadInfos, userInfos: $ReadOnlyArray, currentUserInfo: LoggedOutUserInfo, sessionID?: null | string, diff --git a/lib/types/socket-types.js b/lib/types/socket-types.js index 3796b71281..77ed58699e 100644 --- a/lib/types/socket-types.js +++ b/lib/types/socket-types.js @@ -33,7 +33,7 @@ import { type ClientClientResponse, } from './request-types.js'; import type { SessionState, SessionIdentification } from './session-types.js'; -import { type RawThreadInfo, rawThreadInfoValidator } from './thread-types.js'; +import { rawThreadInfoValidator, type RawThreadInfos } from './thread-types.js'; import { type ClientUpdatesResult, type ClientUpdatesResultWithUserInfos, @@ -183,7 +183,7 @@ export const stateSyncPayloadTypes = Object.freeze({ export const fullStateSyncActionType = 'FULL_STATE_SYNC'; export type BaseFullStateSync = { +messagesResult: MessagesResponse, - +threadInfos: { +[id: string]: RawThreadInfo }, + +threadInfos: RawThreadInfos, +rawEntryInfos: $ReadOnlyArray, +userInfos: $ReadOnlyArray, +updatesCurrentAsOf: number, diff --git a/lib/types/thread-types.js b/lib/types/thread-types.js index a174cec1ac..b576bca0c2 100644 --- a/lib/types/thread-types.js +++ b/lib/types/thread-types.js @@ -215,7 +215,7 @@ export type ServerThreadInfo = { }; export type ThreadStore = { - +threadInfos: { +[id: string]: RawThreadInfo }, + +threadInfos: RawThreadInfos, }; export const threadStoreValidator: TInterface = tShape({ @@ -459,7 +459,7 @@ export const maxReadSidebars = 3; // in the chat tab if every one of the displayed sidebars is unread export const maxUnreadSidebars = 5; -export type ThreadStoreThreadInfos = { +[id: string]: RawThreadInfo }; +export type ThreadStoreThreadInfos = RawThreadInfos; export type ChatMentionCandidates = { +[id: string]: ResolvedThreadInfo }; export type ChatMentionCandidatesObj = { diff --git a/native/redux/edit-thread-permission-migration.js b/native/redux/edit-thread-permission-migration.js index 22f73a548c..5a7dfa5c27 100644 --- a/native/redux/edit-thread-permission-migration.js +++ b/native/redux/edit-thread-permission-migration.js @@ -6,6 +6,7 @@ import type { ThreadCurrentUserInfo, RawThreadInfo, RoleInfo, + RawThreadInfos, } from 'lib/types/thread-types.js'; function addDetailedThreadEditPermissionsToUser< @@ -59,7 +60,7 @@ function addDetailedThreadEditPermissionsToRole( function migrateThreadStoreForEditThreadPermissions(threadInfos: { +[id: string]: RawThreadInfo, -}): { +[id: string]: RawThreadInfo } { +}): RawThreadInfos { const newThreadInfos = {}; for (const threadID in threadInfos) { const threadInfo: RawThreadInfo = threadInfos[threadID]; diff --git a/native/redux/manage-pins-permission-migration.js b/native/redux/manage-pins-permission-migration.js index be372b48bb..f30024c186 100644 --- a/native/redux/manage-pins-permission-migration.js +++ b/native/redux/manage-pins-permission-migration.js @@ -5,9 +5,10 @@ import type { MemberInfo, ThreadCurrentUserInfo, RoleInfo, + RawThreadInfos, } from 'lib/types/thread-types.js'; -type ThreadStoreThreadInfos = { +[id: string]: RawThreadInfo }; +type ThreadStoreThreadInfos = RawThreadInfos; type TargetMemberInfo = MemberInfo | ThreadCurrentUserInfo; const adminRoleName = 'Admins'; diff --git a/native/selectors/message-selectors.js b/native/selectors/message-selectors.js index f3feac4b97..f83301d5e7 100644 --- a/native/selectors/message-selectors.js +++ b/native/selectors/message-selectors.js @@ -6,7 +6,7 @@ import { threadIsPending } from 'lib/shared/thread-utils.js'; import type { ThreadMessageInfo } from 'lib/types/message-types.js'; import { defaultNumberPerThread } from 'lib/types/message-types.js'; import type { ThreadActivityStore } from 'lib/types/thread-activity-types.js'; -import { type RawThreadInfo } from 'lib/types/thread-types.js'; +import { type RawThreadInfos } from 'lib/types/thread-types.js'; import { activeThreadSelector } from '../navigation/nav-selectors.js'; import type { AppState } from '../redux/state-types.js'; @@ -19,7 +19,7 @@ const nextMessagePruneTimeSelector: (state: AppState) => ?number = (state: AppState) => state.threadStore.threadInfos, (state: AppState) => state.threadActivityStore, ( - threadInfos: { +[id: string]: RawThreadInfo }, + threadInfos: RawThreadInfos, threadActivityStore: ThreadActivityStore, ): ?number => { let nextTime; diff --git a/web/redux/nav-reducer.js b/web/redux/nav-reducer.js index d58fa6e6ca..f4e9005c4c 100644 --- a/web/redux/nav-reducer.js +++ b/web/redux/nav-reducer.js @@ -2,7 +2,7 @@ import { pendingToRealizedThreadIDsSelector } from 'lib/selectors/thread-selectors.js'; import { threadIsPending } from 'lib/shared/thread-utils.js'; -import type { RawThreadInfo } from 'lib/types/thread-types.js'; +import type { RawThreadInfos } from 'lib/types/thread-types.js'; import { updateNavInfoActionType } from '../redux/action-types.js'; import type { Action } from '../redux/redux-setup.js'; @@ -11,7 +11,7 @@ import { type NavInfo } from '../types/nav-types.js'; export default function reduceNavInfo( oldState: NavInfo, action: Action, - newThreadInfos: { +[id: string]: RawThreadInfo }, + newThreadInfos: RawThreadInfos, ): NavInfo { let state = oldState; if (action.type === updateNavInfoActionType) { diff --git a/web/selectors/thread-selectors.js b/web/selectors/thread-selectors.js index 235a9f167d..cd9df25305 100644 --- a/web/selectors/thread-selectors.js +++ b/web/selectors/thread-selectors.js @@ -16,7 +16,7 @@ import type { ComposableMessageInfo, RobotextMessageInfo, } from 'lib/types/message-types.js'; -import type { ThreadInfo, RawThreadInfo } from 'lib/types/thread-types.js'; +import type { ThreadInfo, RawThreadInfos } from 'lib/types/thread-types.js'; import { values } from 'lib/utils/objects.js'; import { getDefaultTextMessageRules } from '../markdown/rules.react.js'; @@ -140,10 +140,7 @@ const unreadCountInSelectedCommunity: (state: AppState) => number = createSelector( (state: AppState) => state.threadStore.threadInfos, (state: AppState) => state.communityPickerStore.chat, - ( - threadInfos: { +[id: string]: RawThreadInfo }, - communityID: ?string, - ): number => + (threadInfos: RawThreadInfos, communityID: ?string): number => values(threadInfos).filter( threadInfo => threadInHomeChatList(threadInfo) &&