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 @@ -854,7 +854,7 @@ messageStore, [action.payload.messageInfo], { - [action.payload.messageInfo.threadID]: + [(action.payload.messageInfo.threadID: string)]: messageTruncationStatus.UNCHANGED, }, newThreadInfos, @@ -883,7 +883,9 @@ return mergeNewMessages( messageStore, action.payload.newMessageInfos, - { [action.payload.threadID]: messageTruncationStatus.UNCHANGED }, + { + [(action.payload.threadID: string)]: messageTruncationStatus.UNCHANGED, + }, newThreadInfos, ); } else if (action.type === deleteEntryActionTypes.success) { @@ -952,20 +954,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], @@ -1012,7 +1017,7 @@ threads: messageStore.threads, local: { ...messageStore.local, - [localID]: { sendFailed: true }, + [(localID: string)]: { sendFailed: true }, }, currentAsOf: messageStore.currentAsOf, }, @@ -1450,7 +1455,7 @@ { type: 'replace_threads', payload: { - threads: { [threadID]: threadState }, + threads: { [(threadID: string)]: threadState }, }, }, ]; @@ -1550,7 +1555,7 @@ messageIDsToBeRemoved.push(id); threads = { ...threads, - [threadID]: { + [(threadID: string)]: { ...existingThread, messageIDs: existingThread.messageIDs.filter( curMessageID => curMessageID !== id, @@ -1563,14 +1568,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 }; } }