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 @@ -860,7 +860,7 @@ messageStore, [action.payload.messageInfo], { - [action.payload.messageInfo.threadID]: + [(action.payload.messageInfo.threadID: string)]: messageTruncationStatus.UNCHANGED, }, newThreadInfos, @@ -889,7 +889,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) { @@ -958,20 +960,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], @@ -1018,7 +1023,7 @@ threads: messageStore.threads, local: { ...messageStore.local, - [localID]: { sendFailed: true }, + [(localID: string)]: { sendFailed: true }, }, currentAsOf: messageStore.currentAsOf, }, @@ -1456,7 +1461,7 @@ { type: 'replace_threads', payload: { - threads: { [threadID]: threadState }, + threads: { [(threadID: string)]: threadState }, }, }, ]; @@ -1558,7 +1563,7 @@ messageIDsToBeRemoved.push(id); threads = { ...threads, - [threadID]: { + [(threadID: string)]: { ...existingThread, messageIDs: existingThread.messageIDs.filter( curMessageID => curMessageID !== id, @@ -1571,14 +1576,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 }; } }