import { createStore, combineReducers } from "redux";

import { MusicState } from "./music/types";
import { musicStateReducer } from "./music/reducers";

export interface State {
    musicState: MusicState;
}

const rootReducer = combineReducers<State>({
    musicState: musicStateReducer,
});

export const store = createStore(
    rootReducer,
    // @ts-ignore - These properties are set by the devtools extension
    window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
);

export type Dispatch = typeof store.dispatch;
