Skip to content

redux-offline typescript error in configureStore() #583

Closed
@ifitzsimmons

Description

@ifitzsimmons

I am trying to configure my redux store with redux-offline and I get the following error:

Type '(createStore: StoreCreator) => <T extends { [key: string]: any; }>(reducer: (state: T, action: any) => T, preloadedState: T, enhancer: StoreEnhancer<T, {}>) => Store<...>' is not assignable to type 'StoreEnhancer<{}, {}>'.
  Type '<T extends { [key: string]: any; }>(reducer: (state: T, action: any) => T, preloadedState: T, enhancer: StoreEnhancer<T, {}>) => Store<T, AnyAction>' is not assignable to type 'StoreEnhancerStoreCreator<{}, {}>'.ts(2322)

This is my config:

import { offline } from '@redux-offline/redux-offline';

import createRootReducer from '../reducers';
import offlineConfig from './offlineConfig';

const history = createHashHistory();
const rootReducer = createRootReducer(history);
const router = routerMiddleware(history);
// const enhancer = applyMiddleware(thunk, router);
const middleware = [thunk, router];

function configureStore() {
  return configureStoreTK({
    reducer: rootReducer,
    middleware,
    enhancers: [offline(offlineConfig)]
  });
}

export default { configureStore, history };

I believe I followed the precedent set by the documentation for configuring redux-offline.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions