diff --git a/src/components/Graph/index.tsx b/src/components/Graph/index.tsx index 6bc08b2..15fb8e0 100644 --- a/src/components/Graph/index.tsx +++ b/src/components/Graph/index.tsx @@ -1,12 +1,12 @@ import React from "react"; -import { Canvas } from "reaflow"; +import { Canvas, EdgeData, NodeData } from "reaflow"; import { CustomNode } from "src/components/CustomNode"; import { useConfig } from "src/hocs/config"; import { getEdgeNodes } from "src/containers/LiveEditor/helpers"; export const Graph = () => { - const [nodes, setNodes] = React.useState([]); - const [edges, setEdges] = React.useState([]); + const [nodes, setNodes] = React.useState([]); + const [edges, setEdges] = React.useState([]); const [size, setSize] = React.useState({ width: 2000, height: 2000, diff --git a/src/containers/LiveEditor/helpers.ts b/src/containers/LiveEditor/helpers.ts index 794af38..6cd8f0e 100644 --- a/src/containers/LiveEditor/helpers.ts +++ b/src/containers/LiveEditor/helpers.ts @@ -14,7 +14,13 @@ const toString = (value: string | object) => { return String(value); }; -export function getEdgeNodes(graph: any, isExpanded: boolean = true): any { +export function getEdgeNodes( + graph: string, + isExpanded: boolean = true +): { + nodes: NodeData[]; + edges: EdgeData[]; +} { graph = JSON.parse(graph); const elements = parser(graph);