grungnet/src/actions/AddStatesAction.ts
Mitchell McCaffrey d80bfa2f1e typescript
2021-07-16 14:55:33 +10:00

22 lines
435 B
TypeScript

import Action from "./Action";
import { ID } from "../types/Action";
class AddStatesAction<State extends ID> extends Action<Record<string, State>> {
states: State[];
constructor(states: State[]) {
super();
this.states = states;
}
update(statesById: Record<string, State>) {
for (let state of this.states) {
statesById[state.id] = state;
}
return statesById;
}
}
export default AddStatesAction;