diff --git a/packages/mermaid/src/diagrams/common/commonTypes.ts b/packages/mermaid/src/diagrams/common/commonTypes.ts index ea31c1de80..c5b03ce82f 100644 --- a/packages/mermaid/src/diagrams/common/commonTypes.ts +++ b/packages/mermaid/src/diagrams/common/commonTypes.ts @@ -1,4 +1,4 @@ -import { SVG } from '../../diagram-api/types'; +import type { SVG } from '../../diagram-api/types'; export interface RectData { x: number; diff --git a/packages/mermaid/src/diagrams/sequence/svgDraw.ts b/packages/mermaid/src/diagrams/sequence/svgDraw.ts index 6a970bf325..54efc0c0f1 100644 --- a/packages/mermaid/src/diagrams/sequence/svgDraw.ts +++ b/packages/mermaid/src/diagrams/sequence/svgDraw.ts @@ -406,11 +406,13 @@ const drawActorTypeParticipant = async function ( ); let height = actor.height; - const rectNode = rectElem.node(); - if (rectNode) { - const bounds = rectNode.getBBox(); - actor.height = bounds.height; - height = bounds.height; + if (rectElem.node && typeof rectElem.node === 'function') { + const rectNode = rectElem.node(); + if (rectNode) { + const bounds = rectNode.getBBox(); + actor.height = bounds.height; + height = bounds.height; + } } return height;