我界定了红色标识代码redux-logger”:“^3.0.6”
,载于对store.ts
。 类似:
import { configureStore } from @reduxjs/toolkit ;
import rootReducer from @/redux/reducer/combineReducer ;
import { createLogger } from redux-logger ;
import thunk from redux-thunk ;
import * as Redux from "redux";
import { Middleware } from redux ;
const logger: Redux.Middleware = createLogger();
const initialState = {};
const store = configureStore({
reducer: rootReducer,
middleware: [logger as Middleware, thunk],
devTools: process.env.NODE_ENV !== production ,
preloadedState: initialState
});
export default store;
然后使用<代码>pnpm 跑道对项目进行汇编。
src/redux/store/store.ts:8:7 - error TS2322: Type Middleware<{}, any, Dispatch<UnknownAction>> is not assignable to type Middleware<{}, any, Dispatch<AnyAction>> .
Type (next: (action: unknown) => unknown) => (action: unknown) => unknown is not assignable to type (next: Dispatch<AnyAction>) => (action: any) => any .
Types of parameters next and next are incompatible.
Types of parameters action and action are incompatible.
Type unknown is not assignable to type AnyAction .
8 const logger: Redux.Middleware = createLogger();
~~~~~~
Found 1 error in src/redux/store/store.ts:8
ELIFECYCLE Command failed with exit code 2.
我失踪了吗? 我应该怎样确定这一问题?