0.0.2 • Published 2 years ago
@onsetsoftware/entity-state v0.0.2
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;
}