import { Store } from './types'; export default class SimpleStore< G extends Record, S extends Record = G, > implements Store { constructor(private state: G) {} get(): G { return this.state; } update = (newState: Partial) => { Object.assign(this.state, newState); }; updateTabStates = (id: string, newState: Partial) => { try { Object.assign(this.state.tabStates[id], newState); } catch (e) { console.log( 'Error updating tab state', e, id, newState, this.state, this, ); } }; }