roger
roger

Reputation: 9893

typescript Cannot invoke an expression whose type lacks a call signature?

I am calling combineReducers (import { combineReducers } from 'redux-immutable') in typescript like this:

return combineReducers({
    byId,
    visibleIds
})(state, action)

but typescript complains this:

Cannot invoke an expression whose type lacks a call signature.

so I see the type definition file:

declare module "redux-immutable" {
    export function combineReducers(reducers : Object): Object;
}

how can I call combineReducer correctly?

Upvotes: 0

Views: 2036

Answers (1)

Vadim Macagon
Vadim Macagon

Reputation: 14847

The type definition is wrong, this should work:

declare module "redux-immutable" {
    export function combineReducers(reducers : Object): Function;
}

Though the type definition is the official Redux typings is:

function combineReducers<S>(reducers: ReducersMapObject): Reducer<S>;

Upvotes: 1

Related Questions