Rodux for Roblox TypeScript
npm i @rbxts/rodux.Example:
``ts
import Rodux, { combineReducers, applyMiddleware } from "@rbxts/rodux";
import characterReducer, {
ICharacterReducer,
CharacterActions,
} from "./CharacterReducer";
export interface IStore {
Character: ICharacterReducer;
}
export type StoreActions = CharacterActions;
const reducers = combineReducers
Character: characterReducer,
});
const store = new Rodux.Store
reducers,
{},
[Rodux.thunkMiddleware],
);
`
Explicitly defining the type for Rodux.thunkMiddleware will allow you to get the correct types for the store, otherwise it will be Rodux.Store
If you also use Rodux.loggerMiddleware (or any other middleware) :
`ts``
const store = new Rodux.Store
reducers,
{},
[Rodux.thunkMiddleware, Rodux.loggerMiddleware],
);