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:
type === 'element'→ ElementRecordtype === 'link'→ LinkRecord
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 Parameter | Default type | Description |
|---|---|---|
ElementData | unknown | shape of the custom data payload on elements |
LinkData | unknown | shape of the custom data payload on links |
ElementType extends string | typeof ELEMENT_MODEL_TYPE | the element type discriminator literal |
LinkType extends string | typeof LINK_MODEL_TYPE | the link type discriminator literal |