refactor(types): fix kanbanItem circular types

Exclude the `node.shape` type from `kanbanItem()`, as otherwise it
causes a circular dependency in the types.
This commit is contained in:
Alois Klink 2024-10-29 22:17:24 +09:00
parent 0197c08916
commit 34e8946c58

View File

@ -20,11 +20,12 @@ const colorFromPriority = (priority: NonNullable<KanbanNode['priority']>) => {
return 'lightblue';
}
};
export const kanbanItem = async <T extends SVGGraphicsElement>(
export async function kanbanItem<T extends SVGGraphicsElement>(
parent: D3Selection<T>,
kanbanNode: Node | Omit<KanbanNode, 'level'>,
// Omit the 'shape' prop since otherwise, it causes a TypeScript circular dependency error
kanbanNode: Omit<Node, 'shape'> | Omit<KanbanNode, 'level' | 'shape'>,
{ config }: ShapeRenderOptions
) => {
) {
const { labelStyles, nodeStyles } = styles2String(kanbanNode);
kanbanNode.labelStyle = labelStyles;
@ -160,4 +161,4 @@ export const kanbanItem = async <T extends SVGGraphicsElement>(
};
return shapeSvg;
};
}