mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-25 10:20:06 +02:00
fix: use ParseErrorFunction
alias for mocks
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
import * as configApi from '../config';
|
import * as configApi from '../config';
|
||||||
import { vi } from 'vitest';
|
import { vi } from 'vitest';
|
||||||
import { addDiagrams } from '../diagram-api/diagram-orchestration';
|
import { addDiagrams } from '../diagram-api/diagram-orchestration';
|
||||||
import Diagram from '../Diagram';
|
import Diagram, { type ParseErrorFunction } from '../Diagram';
|
||||||
|
|
||||||
// Normally, we could just do the following to get the original `parse()`
|
// Normally, we could just do the following to get the original `parse()`
|
||||||
// implementation, however, requireActual returns a promise and it's not documented how to use withing mock file.
|
// implementation, however, requireActual returns a promise and it's not documented how to use withing mock file.
|
||||||
@@ -15,8 +15,7 @@ import Diagram from '../Diagram';
|
|||||||
* @param text
|
* @param text
|
||||||
* @param parseError
|
* @param parseError
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
function parse(text: string, parseError?: ParseErrorFunction): boolean {
|
||||||
function parse(text: string, parseError?: Function): boolean {
|
|
||||||
addDiagrams();
|
addDiagrams();
|
||||||
const diagram = new Diagram(text, parseError);
|
const diagram = new Diagram(text, parseError);
|
||||||
return diagram.parse(text, parseError);
|
return diagram.parse(text, parseError);
|
||||||
|
@@ -22,7 +22,7 @@ import classDb from './diagrams/class/classDb';
|
|||||||
import flowDb from './diagrams/flowchart/flowDb';
|
import flowDb from './diagrams/flowchart/flowDb';
|
||||||
import flowRenderer from './diagrams/flowchart/flowRenderer';
|
import flowRenderer from './diagrams/flowchart/flowRenderer';
|
||||||
import ganttDb from './diagrams/gantt/ganttDb';
|
import ganttDb from './diagrams/gantt/ganttDb';
|
||||||
import Diagram, { getDiagramFromText } from './Diagram';
|
import Diagram, { getDiagramFromText, type ParseErrorFunction } from './Diagram';
|
||||||
import errorRenderer from './diagrams/error/errorRenderer';
|
import errorRenderer from './diagrams/error/errorRenderer';
|
||||||
import { attachFunctions } from './interactionDb';
|
import { attachFunctions } from './interactionDb';
|
||||||
import { log, setLogLevel } from './logger';
|
import { log, setLogLevel } from './logger';
|
||||||
@@ -37,8 +37,7 @@ import { evaluate } from './diagrams/common/common';
|
|||||||
* @param text
|
* @param text
|
||||||
* @param parseError
|
* @param parseError
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
function parse(text: string, parseError?: ParseErrorFunction): boolean {
|
||||||
function parse(text: string, parseError?: Function): boolean {
|
|
||||||
addDiagrams();
|
addDiagrams();
|
||||||
const diagram = new Diagram(text, parseError);
|
const diagram = new Diagram(text, parseError);
|
||||||
return diagram.parse(text, parseError);
|
return diagram.parse(text, parseError);
|
||||||
|
Reference in New Issue
Block a user