@onsetsoftware/entity-state
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

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;
}

Readme

Keywords

Package Sidebar

Install

npm i @onsetsoftware/entity-state

Weekly Downloads

1

Version

0.0.2

License

MIT

Unpacked Size

2.46 kB

Total Files

4

Last publish

Collaborators

  • acurrieclark