TypeScript 中的 Firestore reducer

Firestore reducer in TypeScript

我的减速器有以下代码:

import { Reducer, combineReducers } from 'redux';
import { routerReducer } from 'react-router-redux';
import { firebaseReducer } from 'react-redux-firebase';
import { firestoreReducer } from 'redux-firestore';

const reducers: Reducer<ApplicationState> = combineReducers<ApplicationState>({
  firebase: firebaseReducer,
  firestore: firestoreReducer,
  router: routerReducer
});

export { reducers };

我几乎一直在学习可以找到的教程 here

但是 firestore reducer 抱怨以下消息:

Argument of type '{ firebase: typeof firebaseReducer; firestore: typeof firestoreReducer; router: Reducer<RouterSta...' is not assignable to parameter of type 'ReducersMapObject'.
  Property 'firestore' is incompatible with index signature.
    Type 'typeof firestoreReducer' is not assignable to type 'Reducer<any>'.
      Type 'typeof firestoreReducer' provides no match for the signature '(state: any, action: AnyAction): any'.

可能是什么问题以及如何解决?

似乎 TS 正在 firebaseReducer 所在的位置寻找 Reducer,但发现了其他东西。为了解 'something else' 是什么,我查看了类型 found this,然后...很快就搞糊涂了。看起来类型不仅仅是 broken,它们甚至可能不存在。手动投射可能是您最好的选择。

const reducers: Reducer<ApplicationState> = combineReducers<ApplicationState>({
  firebase: firebaseReducer,
  firestore: firestoreReducer as Reducer<ApplicationState>,
  router: routerReducer
});

I'd also consider opening up an issue or PR for this. 以前没有人 运行 对此感到困惑。