@onsetsoftware/entity-state
v0.0.2
Published
Broad types for working with Entity State
Downloads
8
Readme
Entity State
Simple but broad types for working with Entity State.
Installation
pnpm install -D @onsetsoftware/entity-state
Usage
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;
}