diff --git a/native/navigation/nav-from-redux-handler.react.js b/native/navigation/nav-from-redux-handler.react.js --- a/native/navigation/nav-from-redux-handler.react.js +++ b/native/navigation/nav-from-redux-handler.react.js @@ -4,13 +4,16 @@ import { setNavStateActionType } from './action-types.js'; import { NavContext } from './navigation-context.js'; +import type { MonitorActionState } from '../redux/dev-tools.react.js'; import { useSelector } from '../redux/redux-utils.js'; const NavFromReduxHandler: React.ComponentType<{}> = React.memo<{}>( function NavFromReduxHandler() { const navContext = React.useContext(NavContext); - const navStateInRedux = useSelector(state => state.navState); + const navStateInRedux = useSelector( + (state: MonitorActionState) => state.navState, + ); const dispatch = React.useMemo(() => { if (!navContext) { diff --git a/native/redux/dev-tools.react.js b/native/redux/dev-tools.react.js --- a/native/redux/dev-tools.react.js +++ b/native/redux/dev-tools.react.js @@ -1,5 +1,6 @@ // @flow +import type { NavigationState } from '@react-navigation/core'; import * as React from 'react'; import { actionLogger } from 'lib/utils/action-logger.js'; @@ -7,9 +8,18 @@ import { setReduxStateActionType } from './action-types.js'; import { useSelector } from './redux-utils.js'; +import type { AppState } from './state-types.js'; import { setNavStateActionType } from '../navigation/action-types.js'; import { NavContext } from '../navigation/navigation-context.js'; +type MonitorAction = + | { +type: 'DISPATCH', +state: string, ... } + | { +type: 'IMPORT', ... }; +export type MonitorActionState = $ReadOnly<{ + ...AppState, + +navState: NavigationState, +}>; + const DevTools: React.ComponentType<{}> = React.memo<{}>(function DevTools() { const devToolsRef = React.useRef(); if ( @@ -79,7 +89,7 @@ ); const setInternalState = React.useCallback( - state => { + (state: MonitorActionState) => { const { navState, ...reduxState } = state; if (navDispatch) { navDispatch({ @@ -104,7 +114,7 @@ ); const handleActionFromMonitor = React.useCallback( - monitorAction => { + (monitorAction: MonitorAction) => { if (!devTools) { return; }