Skip to content

Documentation / @etherfold/processor-entities / declareEntities

Function: declareEntities() ​

declareEntities<D>(declarations): D

Defined in: packages/state-store/dist/declarations.d.ts:47

Pin the literal types of a set of declarations, and check their shape.

The value is unchanged and is still an ordinary readonly EntityDeclaration[], so the SAME array goes to the store's constructor, to a processor's entities and to createReadSurface. That is the point: one array, one description.

ts
const entities = declareEntities([{name: 'token', id: 'id', fields: {owner: 'text'}}]);
const store = new MemoryStateStore(entities);
const surface = createReadSurface(store, entities);

Type Parameters ​

D ​

D extends readonly EntityDeclaration[]

Parameters ​

declarations ​

D

Returns ​

D