Skip to main content
Version: 4.3

CellRecord

type CellRecord<ElementData, LinkData, ElementType, LinkType> = 
| ElementRecord<ElementData, ElementType>
| LinkRecord<LinkData, LinkType>;

One cell — either an ElementRecord or a LinkRecord — as a discriminated union on type:

Because it discriminates on type, if (cell.type === 'element') narrows correctly inside arrays and hooks. For mixed built-in shape arrays with typed data, build the union yourself: ElementRecord<MyData, 'standard.Rectangle'> | LinkRecord<MyData, 'standard.Link'>.

Type Parameters

Type ParameterDefault typeDescription
ElementDataunknownshape of the custom data payload on elements
LinkDataunknownshape of the custom data payload on links
ElementType extends stringtypeof ELEMENT_MODEL_TYPEthe element type discriminator literal
LinkType extends stringtypeof LINK_MODEL_TYPEthe link type discriminator literal

Stay in the know

Be where thousands of diagramming enthusiasts meet

Star us on GitHub