Javascript 为具有返回值的Redux Thunk操作添加流类型

Javascript 为具有返回值的Redux Thunk操作添加流类型,javascript,react-native,redux,flowtype,redux-thunk,Javascript,React Native,Redux,Flowtype,Redux Thunk,我有一个thunk操作,在分派其他操作后,返回一个布尔值。我不确定如何用Flow输入这个。这就是行动: export const checkAuthStatus = (): ThunkAction => async (dispatch) => { const token = await getFromStorage('authToken'); const user = await getFromStorage('authUser', true); const prompt

我有一个thunk操作,在分派其他操作后,返回一个
布尔值。我不确定如何用Flow输入这个。这就是行动:

export const checkAuthStatus = (): ThunkAction => async (dispatch) => {
  const token = await getFromStorage('authToken');
  const user = await getFromStorage('authUser', true);
  const promptSkipped = await getFromStorage('promptSkipped', true);

  const loggedIn = token && user;

  if (loggedIn) {
    dispatch(setLoggedIn(token, user));
    dispatch(getUserInBackground());
  }

  return promptSkipped;
};
ThunkAction
返回类型来自于where
Action
中的此代码段,当前包括所有非ThunkAction的类型:

type GetState = () => State;
type PromiseAction = Promise<Action>;
type ThunkAction = (dispatch: Dispatch, getState: GetState) => any;
type Dispatch = (action: Action | ThunkAction | PromiseAction | Array<Action>) => any;
感谢您的帮助


编辑


我需要第
30行
出错,因为我试图将
字符串
添加到
布尔值
,但正如您所见,它抛出了上述错误。

请提供更多信息。以下是如何编写一个示例供参考。@PeterHall我编辑了这篇文章以添加一个示例。