When designing/typing internal and public APIs, keep signatures tight and future-proof:
config isn’t needed, remove it from the function signature (or make it optional only where truly required).Example (extensible options object):
type ShapeOptions = {
config?: { themeVariables: unknown };
};
export const filledCircle = (
parent: SVG,
node: Node,
{ config }: ShapeOptions = {}
) => {
const themeVariables = config?.themeVariables;
// ...render using themeVariables (or a default if absent)
};
Example (prefer optional/options instead of extra required positional params):
type RenderDraw = (
text: string,
id: string,
version: string,
diagramObject: Diagram,
opts?: { error?: Error | null }
) => void;
Applying these standards reduces breaking changes, makes internal renderer/diagram code easier to evolve, and ensures public APIs behave predictably.
Enter the URL of a public GitHub repository