首页 > 解决方案 > 为什么 redux 的 combine reducer 在使用 typescript 和 react-redux-firebase 时会抱怨方法重载?

问题描述

问题

我有一个只有最小样板的基本项目,因为我想尝试react-redux-firebase. 所以我根据这里的打字稿示例设置了所有内容:https ://github.com/prescottprue/react-redux-firebase/tree/master/examples/complete/typescript

但是这部分:

const rootReducer = combineReducers<RootState>({
  firebase: firebaseReducer,
  firestore: firestoreReducer
});

正在抱怨:

> firestore: Reducer<FirestoreReducer.Reducer, any> No overload matches
> this call. Overload 1 of 3,

我做了一个最小的代码框演示来重现这个问题:

https://codesandbox.io/s/great-perlman-p6g7p?file=/src/store/index.ts

54尽管应用程序运行良好,但您可以在线看到错误。在我的本地客户端上它不会呈现,我只是在浏览器中看到错误(重载......)。

我在这里做错了什么?它必须是关于打字稿的,当谈到打字稿时,我是一个真正的初学者。

标签: reactjstypescriptredux

解决方案


推荐阅读