diff --git a/lib/components/modal-overlay.react.js b/lib/components/modal-overlay.react.js --- a/lib/components/modal-overlay.react.js +++ b/lib/components/modal-overlay.react.js @@ -24,7 +24,7 @@ } = props; const overlayRef = React.useRef(); - const firstClickRef = React.useRef(null); + const firstClickRef = React.useRef(null); React.useLayoutEffect(() => { if (overlayRef.current) { @@ -32,12 +32,15 @@ } }, []); - const onBackgroundMouseDown = React.useCallback(event => { - firstClickRef.current = event.target; - }, []); + const onBackgroundMouseDown = React.useCallback( + (event: SyntheticEvent) => { + firstClickRef.current = event.target; + }, + [], + ); const onBackgroundMouseUp = React.useCallback( - event => { + (event: SyntheticEvent) => { if ( event.target === overlayRef.current && firstClickRef.current === overlayRef.current @@ -49,7 +52,7 @@ ); const onKeyDown = React.useCallback( - event => { + (event: SyntheticKeyboardEvent) => { if (event.key === 'Escape') { onClose(); } diff --git a/lib/components/modal-provider.react.js b/lib/components/modal-provider.react.js --- a/lib/components/modal-provider.react.js +++ b/lib/components/modal-provider.react.js @@ -34,7 +34,7 @@ () => setModals(oldModals => oldModals.slice(0, -1)), [], ); - const pushModal = React.useCallback(newModal => { + const pushModal = React.useCallback((newModal: React.Node) => { const key = getUUID(); setModals(oldModals => [...oldModals, [newModal, key]]); return key; diff --git a/lib/hooks/child-threads.js b/lib/hooks/child-threads.js --- a/lib/hooks/child-threads.js +++ b/lib/hooks/child-threads.js @@ -14,8 +14,11 @@ import { childThreadInfos } from '../selectors/thread-selectors.js'; import { threadInChatList } from '../shared/thread-utils.js'; import threadWatcher from '../shared/thread-watcher.js'; -import type { MinimallyEncodedThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; -import type { ThreadInfo } from '../types/thread-types.js'; +import type { + MinimallyEncodedThreadInfo, + MinimallyEncodedRawThreadInfo, +} from '../types/minimally-encoded-thread-permissions-types.js'; +import type { ThreadInfo, RawThreadInfo } from '../types/thread-types.js'; import { useDispatchActionPromise } from '../utils/action-utils.js'; import { useSelector } from '../utils/redux-utils.js'; @@ -41,7 +44,20 @@ }, [childThreads, predicate]); const filterSubchannels = React.useCallback( - thread => subchannelIDs.has(thread?.id), + ( + thread: ?( + | ThreadInfo + | RawThreadInfo + | MinimallyEncodedThreadInfo + | MinimallyEncodedRawThreadInfo + ), + ) => { + const candidateThreadID = thread?.id; + if (!candidateThreadID) { + return false; + } + return subchannelIDs.has(candidateThreadID); + }, [subchannelIDs], ); const allSubchannelsList = useFilteredChatListData(filterSubchannels); diff --git a/lib/shared/state-sync/entries-state-sync-spec.js b/lib/shared/state-sync/entries-state-sync-spec.js --- a/lib/shared/state-sync/entries-state-sync-spec.js +++ b/lib/shared/state-sync/entries-state-sync-spec.js @@ -75,10 +75,12 @@ (state: AppState) => state.entryStore.entryInfos, entryInfos => ({ ...entriesStateSyncSpec, - getInfoHash: id => hash(entryInfos[`${ashoatKeyserverID}|${id}`]), - getAllInfosHash: calendarQuery => + getInfoHash: (id: string) => + hash(entryInfos[`${ashoatKeyserverID}|${id}`]), + getAllInfosHash: (calendarQuery: CalendarQuery) => getEntryInfosHash(entryInfos, calendarQuery), - getIDs: calendarQuery => getEntryIDs(entryInfos, calendarQuery), + getIDs: (calendarQuery: CalendarQuery) => + getEntryIDs(entryInfos, calendarQuery), }), ), }); diff --git a/lib/shared/state-sync/threads-state-sync-spec.js b/lib/shared/state-sync/threads-state-sync-spec.js --- a/lib/shared/state-sync/threads-state-sync-spec.js +++ b/lib/shared/state-sync/threads-state-sync-spec.js @@ -59,7 +59,7 @@ state.integrityStore.threadHashingStatus === 'completed', (threadHashes, threadHashingComplete) => ({ ...threadsStateSyncSpec, - getInfoHash: id => threadHashes[`${ashoatKeyserverID}|${id}`], + getInfoHash: (id: string) => threadHashes[`${ashoatKeyserverID}|${id}`], getAllInfosHash: threadHashingComplete ? () => combineUnorderedHashes(values(threadHashes)) : () => null, diff --git a/lib/shared/state-sync/users-state-sync-spec.js b/lib/shared/state-sync/users-state-sync-spec.js --- a/lib/shared/state-sync/users-state-sync-spec.js +++ b/lib/shared/state-sync/users-state-sync-spec.js @@ -56,7 +56,7 @@ (state: AppState) => state.userStore.userInfos, userInfos => ({ ...usersStateSyncSpec, - getInfoHash: id => hash(userInfos[id]), + getInfoHash: (id: string) => hash(userInfos[id]), getAllInfosHash: () => combineUnorderedHashes(Object.values(userInfos).map(hash)), getIDs: () => Object.keys(userInfos),