我正在尝试将 RTK-Query 中间件添加到嵌套存储结构中,当我添加 api 中间件时,我遇到了一个非常长且非描述性的打字稿错误......
这是我的代码:
export const rootReducer = combineReducers({
foo: fooReducer,
nested: combineReducers({
bar: barReducer,
[myFooApi.reducerPath]: myFooApi.reducer,
})
});
const store = configureStore({
reducer: rootReducer,
middleware: (getDefaultMiddleware) => // Getting TS2322 error: type is not assignable to type...
getDefaultMiddleware().concat(tokenListsApi.middleware)
});
当我[fooApi.reducerPath]
像这样移动到减速器的根部时,错误消失了:
export const rootReducer = combineReducers({
foo: fooReducer,
bar: barReducer,
[fooApi.reducerPath]: fooApi.reducer,
});
我正在寻找 RTK-Query Api 减速器的嵌套使用示例,但找不到任何...我错过了什么?