我在combineReducers
中拨打import { combineReducers } from 'redux-immutable'
(typescript
),如下所示:
return combineReducers({
byId,
visibleIds
})(state, action)
但是打字稿抱怨这个:
Cannot invoke an expression whose type lacks a call signature.
所以我看到了类型定义文件:
declare module "redux-immutable" {
export function combineReducers(reducers : Object): Object;
}
如何正确调用combineReducer
?
答案 0 :(得分:1)
类型定义错误,这应该有效:
declare module "redux-immutable" {
export function combineReducers(reducers : Object): Function;
}
虽然类型定义是官方Redux typings是:
function combineReducers<S>(reducers: ReducersMapObject): Reducer<S>;