diff --git a/lib/components/integrity-handler.react.js b/lib/components/integrity-handler.react.js --- a/lib/components/integrity-handler.react.js +++ b/lib/components/integrity-handler.react.js @@ -17,8 +17,9 @@ const threadInfos = useSelector(state => state.threadStore.threadInfos); const integrityStore = useSelector(state => state.integrityStore); - const [batches, setBatches] = React.useState(null); - const timeout = React.useRef(null); + const [batches, setBatches] = + React.useState>>(null); + const timeout = React.useRef(null); React.useEffect(() => { if (integrityStore.threadHashingStatus === 'starting') { 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 @@ -23,8 +23,8 @@ backgroundColor = 'var(--modal-overlay-background-90)', } = props; - const overlayRef = React.useRef(); - const firstClickRef = React.useRef(null); + const overlayRef = React.useRef(); + const firstClickRef = React.useRef(null); React.useLayoutEffect(() => { if (overlayRef.current) { diff --git a/lib/components/thread-draft-updater.react.js b/lib/components/thread-draft-updater.react.js --- a/lib/components/thread-draft-updater.react.js +++ b/lib/components/thread-draft-updater.react.js @@ -17,7 +17,7 @@ ); const dispatch = useDispatch(); - const cachedThreadIDsRef = React.useRef(); + const cachedThreadIDsRef = React.useRef>(); if (!cachedThreadIDsRef.current) { const newCachedThreadIDs = new Set(); for (const realizedThreadID of pendingToRealizedThreadIDs.values()) { diff --git a/lib/hooks/disconnected-bar.js b/lib/hooks/disconnected-bar.js --- a/lib/hooks/disconnected-bar.js +++ b/lib/hooks/disconnected-bar.js @@ -5,7 +5,10 @@ import { useDispatch } from 'react-redux'; import { connectionSelector } from '../selectors/keyserver-selectors.js'; -import { updateDisconnectedBarActionType } from '../types/socket-types.js'; +import { + updateDisconnectedBarActionType, + type ConnectionStatus, +} from '../types/socket-types.js'; import { useSelector } from '../utils/redux-utils.js'; function useDisconnectedBarVisibilityHandler(networkConnected: boolean): void { @@ -27,7 +30,7 @@ [disconnected, dispatch], ); - const networkActiveRef = React.useRef(true); + const networkActiveRef = React.useRef(true); React.useEffect(() => { networkActiveRef.current = networkConnected; if (!networkConnected) { @@ -35,7 +38,7 @@ } }, [setDisconnected, networkConnected]); - const prevConnectionStatusRef = React.useRef(); + const prevConnectionStatusRef = React.useRef(); const connectionStatus = connection.status; const someRequestIsLate = connection.lateResponses.length !== 0; React.useEffect(() => { @@ -84,7 +87,7 @@ const { disconnected, shouldShowDisconnectedBar } = useShouldShowDisconnectedBar(); - const prevShowDisconnectedBar = React.useRef(); + const prevShowDisconnectedBar = React.useRef(); React.useEffect(() => { const wasShowing = prevShowDisconnectedBar.current; if (shouldShowDisconnectedBar && wasShowing === false) { diff --git a/lib/hooks/search-threads.js b/lib/hooks/search-threads.js --- a/lib/hooks/search-threads.js +++ b/lib/hooks/search-threads.js @@ -34,7 +34,7 @@ threadInfo: ThreadInfo, childThreadInfos: $ReadOnlyArray, ): SearchThreadsResult { - const [searchState, setSearchState] = React.useState({ + const [searchState, setSearchState] = React.useState({ text: '', results: new Set(), }); diff --git a/lib/shared/thread-utils.js b/lib/shared/thread-utils.js --- a/lib/shared/thread-utils.js +++ b/lib/shared/thread-utils.js @@ -1413,7 +1413,9 @@ const [threadSearchResults, setThreadSearchResults] = React.useState( new Set(), ); - const [usersSearchResults, setUsersSearchResults] = React.useState([]); + const [usersSearchResults, setUsersSearchResults] = React.useState< + $ReadOnlyArray, + >([]); const threadSearchIndex = useGlobalThreadSearchIndex(); React.useEffect(() => { (async () => { diff --git a/lib/socket/activity-handler.react.js b/lib/socket/activity-handler.react.js --- a/lib/socket/activity-handler.react.js +++ b/lib/socket/activity-handler.react.js @@ -12,6 +12,7 @@ import { getMostRecentNonLocalMessageID } from '../shared/message-utils.js'; import { threadIsPending } from '../shared/thread-utils.js'; import { queueActivityUpdatesActionType } from '../types/activity-types.js'; +import type { ConnectionStatus } from '../types/socket-types.js'; import { useServerCall, useDispatchActionPromise, @@ -25,7 +26,7 @@ function ActivityHandler(props: Props): React.Node { const { activeThread, frozen } = props; - const prevActiveThreadRef = React.useRef(); + const prevActiveThreadRef = React.useRef(); React.useEffect(() => { prevActiveThreadRef.current = activeThread; }, [activeThread]); @@ -34,7 +35,7 @@ const connection = useSelector(connectionSelector); invariant(connection, 'keyserver missing from keyserverStore'); const connectionStatus = connection.status; - const prevConnectionStatusRef = React.useRef(); + const prevConnectionStatusRef = React.useRef(); React.useEffect(() => { prevConnectionStatusRef.current = connectionStatus; }, [connectionStatus]); @@ -46,7 +47,7 @@ } return getMostRecentNonLocalMessageID(activeThread, state.messageStore); }); - const prevActiveThreadLatestMessageRef = React.useRef(); + const prevActiveThreadLatestMessageRef = React.useRef(); React.useEffect(() => { prevActiveThreadLatestMessageRef.current = activeThreadLatestMessage; }, [activeThreadLatestMessage]); @@ -54,7 +55,7 @@ prevActiveThreadLatestMessageRef.current; const canSend = connectionStatus === 'connected' && !frozen; - const prevCanSendRef = React.useRef(); + const prevCanSendRef = React.useRef(); React.useEffect(() => { prevCanSendRef.current = canSend; }, [canSend]);