fix: Return type, make config non optional

Co-authored-by: Alois Klink <alois@aloisklink.com>
This commit is contained in:
Sidharth Vinod
2024-09-09 17:30:22 +05:30
parent 303f1f4545
commit c0187101e9
2 changed files with 3 additions and 3 deletions

View File

@@ -49,7 +49,7 @@ const processDirectives = (code: string) => {
* @param code - The code to preprocess. * @param code - The code to preprocess.
* @returns The object containing the preprocessed code, title, and configuration. * @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 cleanedCode = cleanupText(code);
const frontMatterResult = processFrontmatter(cleanedCode); const frontMatterResult = processFrontmatter(cleanedCode);
const directiveResult = processDirectives(frontMatterResult.text); const directiveResult = processDirectives(frontMatterResult.text);
@@ -59,5 +59,5 @@ export function preprocessDiagram(code: string): DiagramMetadata & { code: strin
code, code,
title: frontMatterResult.title, title: frontMatterResult.title,
config, config,
}; } satisfies DiagramMetadata & { code: string };
} }

View File

@@ -53,7 +53,7 @@ export interface ParseResult {
/** /**
* The config passed as YAML frontmatter or directives * 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. // 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; export type D3Element = any;