From c0187101e9cb3ea9d1966575efcd80ebb6a9a203 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Mon, 9 Sep 2024 17:30:22 +0530 Subject: [PATCH] fix: Return type, make config non optional Co-authored-by: Alois Klink --- packages/mermaid/src/preprocess.ts | 4 ++-- packages/mermaid/src/types.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/mermaid/src/preprocess.ts b/packages/mermaid/src/preprocess.ts index 10bc0adea..a62326070 100644 --- a/packages/mermaid/src/preprocess.ts +++ b/packages/mermaid/src/preprocess.ts @@ -49,7 +49,7 @@ const processDirectives = (code: string) => { * @param code - The code to preprocess. * @returns The object containing the preprocessed code, title, and configuration. */ -export function preprocessDiagram(code: string): DiagramMetadata & { code: string } { +export function preprocessDiagram(code: string) { const cleanedCode = cleanupText(code); const frontMatterResult = processFrontmatter(cleanedCode); const directiveResult = processDirectives(frontMatterResult.text); @@ -59,5 +59,5 @@ export function preprocessDiagram(code: string): DiagramMetadata & { code: strin code, title: frontMatterResult.title, config, - }; + } satisfies DiagramMetadata & { code: string }; } diff --git a/packages/mermaid/src/types.ts b/packages/mermaid/src/types.ts index ae97bd69b..d8b4c4aa0 100644 --- a/packages/mermaid/src/types.ts +++ b/packages/mermaid/src/types.ts @@ -53,7 +53,7 @@ export interface ParseResult { /** * The config passed as YAML frontmatter or directives */ - config?: MermaidConfig; + config: MermaidConfig; } // This makes it clear that we're working with a d3 selected element of some kind, even though it's hard to specify the exact type. export type D3Element = any;