MakeStore显示通用类型'MakeStore'需要1个类型参数。ts(2314)
configureStore。
import {
configureStore,
EnhancedStore,
getDefaultMiddleware,
} from '@reduxjs/toolkit';
import { MakeStore } from 'next-redux-wrapper';
import { Env } from '../constants';
import { rootReducer, RootState } from './reducers';
import logger from 'redux-logger';
const store = configureStore({
reducer: rootReducer,
middleware: (getDefaultMiddleware) =>
getDefaultMiddleware()
.concat(logger),
devTools: Env.NODE_ENV === 'development',
});
export const makeStore: MakeStore = (_?: RootState): EnhancedStore => store;
提前感谢。
删除EnhancedStore
类型。您应该永远不要直接使用该类型,因为您实际上最终会丢弃从调用configureStore()
本身推断出的实际类型信息。