diff --git a/lib/reducers/entry-reducer.js b/lib/reducers/entry-reducer.js --- a/lib/reducers/entry-reducer.js +++ b/lib/reducers/entry-reducer.js @@ -290,7 +290,7 @@ invariant(localID, 'localID should be set in CREATE_LOCAL_ENTRY'); const newEntryInfos = { ...entryInfos, - [localID]: entryInfo, + [(localID: string)]: entryInfo, }; const dayString = dateString( entryInfo.year, @@ -405,7 +405,7 @@ invariant(id, 'either serverID or localID should be set'); const newEntryInfos = { ...entryInfos, - [id]: { + [(id: string)]: { ...entryInfos[id], deleted: true, }, diff --git a/lib/reducers/message-reducer.js b/lib/reducers/message-reducer.js --- a/lib/reducers/message-reducer.js +++ b/lib/reducers/message-reducer.js @@ -898,7 +898,7 @@ messageStore, [action.payload.messageInfo], { - [action.payload.messageInfo.threadID]: + [(action.payload.messageInfo.threadID: string)]: messageTruncationStatus.UNCHANGED, }, newThreadInfos, @@ -929,7 +929,9 @@ return mergeNewMessages( messageStore, action.payload.newMessageInfos, - { [action.payload.threadID]: messageTruncationStatus.UNCHANGED }, + { + [(action.payload.threadID: string)]: messageTruncationStatus.UNCHANGED, + }, newThreadInfos, action.type, ); @@ -1002,20 +1004,23 @@ let updatedThreads; let local = { ...messageStore.local }; if (messageStore.messages[localID]) { - const messages = { ...messageStore.messages, [localID]: payload }; + const messages = { + ...messageStore.messages, + [(localID: string)]: payload, + }; local = _pickBy( (localInfo: LocalMessageInfo, key: string) => key !== localID, )(messageStore.local); const thread = messageStore.threads[threadID]; updatedThreads = { - [threadID]: { + [(threadID: string)]: { messageIDs: sortMessageIDs(messages)(messageIDs), startReached: thread?.startReached ?? true, }, }; } else { updatedThreads = { - [threadID]: messageStore.threads[threadID] + [(threadID: string)]: messageStore.threads[threadID] ? { ...messageStore.threads[threadID], messageIDs: [localID, ...messageIDs], @@ -1072,7 +1077,7 @@ threads: messageStore.threads, local: { ...messageStore.local, - [localID]: { sendFailed: true }, + [(localID: string)]: { sendFailed: true }, }, currentAsOf: messageStore.currentAsOf, }, @@ -1545,7 +1550,7 @@ { type: 'replace_threads', payload: { - threads: { [threadID]: threadState }, + threads: { [(threadID: string)]: threadState }, }, }, ]; @@ -1559,7 +1564,7 @@ ...messageStore, threads: { ...messageStore.threads, - [threadID]: threadState, + [(threadID: string)]: threadState, }, messages: processedMessageStore.messages, }; @@ -1663,7 +1668,7 @@ messageIDsToBeRemoved.push(id); threads = { ...threads, - [threadID]: { + [(threadID: string)]: { ...existingThread, messageIDs: existingThread.messageIDs.filter( curMessageID => curMessageID !== id, @@ -1676,14 +1681,14 @@ } else if (!existingMessageIDs.has(id)) { threads = { ...threads, - [threadID]: { + [(threadID: string)]: { ...existingThread, messageIDs: [...existingThread.messageIDs, id], }, }; threadsNeedMsgIDsResorting.add(threadID); } else if (!threads[threadID]) { - threads = { ...threads, [threadID]: existingThread }; + threads = { ...threads, [(threadID: string)]: existingThread }; } }