Simple but broad types for working with Entity State.
pnpm install -D @onsetsoftware/entity-state
import type { EntityState, HasId } from '@onsetsoftware/entity-state';
export function addEntity<TEntity extends HasId<TEntity>>(
state: EntityState<TEntity>,
entity: TEntity,
) {
state.ids.push(entity.id);
state.entities[entity.id] = entity;
return state;
}