Hi, I'm new to this typescript. I have no choice but to do it for my project. I've encountered this error. can anybody help with it?
#rootReducer: Errors
10 messages · Page 1 of 1 (latest)
!screenshot
`!screenshot`:
Rather than screenshots, please provide either code formatted as:
```ts
// code here
```
Or even better, as an example on the TypeScript playground that is as simple as possible and reproduces the issue. This makes it easier to help you and increases the chances of getting an answer.
my bad
wait
import { combineReducers } from "redux";
import { History } from "history";
import { settings, IState as SettingsState } from "./settings/reducer";
import { sidebar, IState as SidebarState } from "./sidebar/reducer";
import { modals, IState as ModalState } from "./modals/reducer";
import { graph, IState as GraphState } from "./graph/reducer";
import { path, IState as PathState } from "./path/reducer";
import { search, IState as SearchState } from "./search/reducer";
import { api, IState as ApiState } from "./api/reducer";
//import { settingsReducer } from "@/app/campus/settings/reducer";
export interface AppState {
settings: SettingsState;
sidebar: SidebarState;
modals: ModalState;
graph: GraphState;
path: PathState;
search: SearchState;
api: ApiState;
}
const rootReducer = combineReducers<AppState>({
settings,
sidebar,
modals,
graph,
path,
search,
api,
});
export type RootState = ReturnType<typeof rootReducer>;
export default (history: History) => rootReducer;
import { Reducer } from "redux";
import { TOGGLE_SIDEBAR } from "./constant";
import { Action } from "@/app/store/actions";
export type IState = {
readonly isOpen: boolean;
};
export const initialState: IState = {
isOpen: true,
};
export const sidebar: Reducer<IState, Action> = (
state = initialState,
action: Action
) => {
switch (action.type) {
case TOGGLE_SIDEBAR:
return {
...state,
isOpen: !state.isOpen,
};
default:
return state;
}
};
the file you have open is sidebar/reducer, but the error is on settings/reducer
the sidebar also had same error
const rootReducer = combineReducers<AppState>({
settings,
sidebar,
modals,
graph,
path,
search,
api,
});