Reactjs Redux Thunk和#x2019的正确类型;TypeScript中的调度函数

Reactjs Redux Thunk和#x2019的正确类型;TypeScript中的调度函数,reactjs,typescript,redux,redux-thunk,Reactjs,Typescript,Redux,Redux Thunk,我用Redux Thunk在TypeScript中运行了一些React代码 行动: export interface IAddTodoAction { text: string type: ADD_TODO } export type TodoAction = IAddTodoAction | IToggleTodoAction | IEditTodoAction | IDeleteTodoAction | IToggleAllTodoAction export const

我用Redux Thunk在TypeScript中运行了一些React代码

行动:

export interface IAddTodoAction {
    text: string
    type: ADD_TODO
}

export type TodoAction = IAddTodoAction | IToggleTodoAction | IEditTodoAction | IDeleteTodoAction | IToggleAllTodoAction

export const addTodo = (text: string): IAddTodoAction => ({
    text,
    type: ADD_TODO,
})

export const testThunk = (employeeId: number): ThunkAction<void, RootState, unknown, Action<string>> => async (dispatch: Dispatch) => {
    try {
        const asyncResp = await axios.get(`https://jsonplaceholder.typicode.com/todos/${employeeId}`)
        console.log("asyncResp", asyncResp)
        const title = asyncResp.data.title
        console.log("title", title)
        dispatch(addTodo(title))
        // dispatch({ title, type: ADD_TODO })
    } catch (error) {
        console.log(error)
    }
}
当我在
MapDispatcherOps
testThunk
中使用
作为
调度
调用的类型时,代码运行良好

有人能告诉我应该使用哪种类型而不是
any

const mapDispatcherToProps = (dispatch: Dispatch): { addTodo: (text: string) => void } | { testThunk: (employeeId: number) => void } => ({
    addTodo: (text: string) => dispatch(actions.addTodo(text)),
    testThunk: (employeeId: number) => dispatch<any>(actions.testThunk(employeeId)),
})