@joint/react
    Preparing search index...

    Type Alias InferElement<Cells>

    InferElement: Extract<
        CellArrayMember<Cells>,
        { type: typeof ELEMENT_MODEL_TYPE },
    >

    Infer the element record type from a cells collection, typically typeof cells. Selects the member whose type is 'element', so a mixed array narrows to its element variant with the inferred data shape. Compose with Computed for reading hooks, or index ['data'] for the render-data type.

    Custom shapes (a type other than 'element') are excluded, type the record union manually for those, as documented on CellRecord.

    Type Parameters

    • Cells

      the cells collection to infer from, usually typeof cells

    import type { InferElement } from '@joint/react';

    const cells = [
    { id: 'a', type: 'element', data: { label: 'A' } },
    { id: 'e', type: 'link', source: { id: 'a' }, target: { id: 'b' }, data: { weight: 2 } },
    ] as const;

    type Node = InferElement<typeof cells>; // element variant of the union
    type NodeData = InferElement<typeof cells>['data']; // { label: 'A' }