chore: Fix config type

This commit is contained in:
Sidharth Vinod
2024-01-28 21:43:03 +05:30
parent d346a77e3c
commit e1a23f10df
5 changed files with 31 additions and 21 deletions

View File

@@ -2,8 +2,12 @@ import assignWithDepth from './assignWithDepth.js';
import { log } from './logger.js';
import theme from './themes/index.js';
import config from './defaultConfig.js';
import type { MermaidConfig, MermaidConfigWithDefaults } from './config.type.js';
import type { MermaidConfig } from './config.type.js';
import { sanitizeDirective } from './utils/sanitizeDirective.js';
import type { RequiredDeep } from 'type-fest';
// I'd prefer this to be named MermaidConfig, so all the functions can use the shorter name.
export type MermaidConfigWithDefaults = RequiredDeep<MermaidConfig>;
export const defaultConfig: MermaidConfig = Object.freeze(config);

View File

@@ -5,8 +5,6 @@
* and run json-schema-to-typescript to regenerate this file.
*/
import { RequiredDeep } from 'type-fest';
/**
* Configuration options to pass to the `dompurify` library.
*/
@@ -167,9 +165,6 @@ export interface MermaidConfig {
wrap?: boolean;
fontSize?: number;
}
// I'd prefer this to be named MermaidConfig, so all the functions can use the shorter name.
export type MermaidConfigWithDefaults = RequiredDeep<MermaidConfig>;
/**
* This interface was referenced by `MermaidConfig`'s JSON-Schema
* via the `definition` "BaseDiagramConfig".

View File

@@ -7,10 +7,11 @@ import cytoscape from 'cytoscape';
// @ts-expect-error No types available
import coseBilkent from 'cytoscape-cose-bilkent';
import * as db from './mindmapDb.js';
import type { MermaidConfig, MermaidConfigWithDefaults } from '../../config.type.js';
import type { MermaidConfig } from '../../config.type.js';
import type { Diagram } from '../../Diagram.js';
import type { MindmapDB } from './mindmapTypes.js';
import type { D3Element } from '../../mermaidAPI.js';
import type { MermaidConfigWithDefaults } from '../../config.js';
// Inject the layout algorithm into cytoscape
cytoscape.use(coseBilkent);