diff --git a/packages/react/src/types/changes.ts b/packages/react/src/types/changes.ts index 3dfdffa2..9a5e8fe5 100644 --- a/packages/react/src/types/changes.ts +++ b/packages/react/src/types/changes.ts @@ -44,13 +44,13 @@ export type NodeReplaceChange = { * Union type of all possible node changes. * @public */ -export type NodeChange = +export type NodeChange = | NodeDimensionChange | NodePositionChange | NodeSelectionChange | NodeRemoveChange - | NodeAddChange - | NodeReplaceChange; + | NodeAddChange + | NodeReplaceChange; export type EdgeSelectionChange = NodeSelectionChange; export type EdgeRemoveChange = NodeRemoveChange; @@ -64,4 +64,9 @@ export type EdgeReplaceChange = { item: EdgeType; type: 'replace'; }; -export type EdgeChange = EdgeSelectionChange | EdgeRemoveChange | EdgeAddChange | EdgeReplaceChange; + +export type EdgeChange = + | EdgeSelectionChange + | EdgeRemoveChange + | EdgeAddChange + | EdgeReplaceChange; diff --git a/packages/react/src/types/general.ts b/packages/react/src/types/general.ts index a1d76983..82cb23ce 100644 --- a/packages/react/src/types/general.ts +++ b/packages/react/src/types/general.ts @@ -16,8 +16,8 @@ import { import type { NodeChange, EdgeChange, Node, Edge, ReactFlowInstance, EdgeProps } from '.'; import { ComponentType } from 'react'; -export type OnNodesChange = (changes: NodeChange[]) => void; -export type OnEdgesChange = (changes: EdgeChange[]) => void; +export type OnNodesChange = (changes: NodeChange[]) => void; +export type OnEdgesChange = (changes: EdgeChange[]) => void; export type OnNodesDelete = (nodes: Node[]) => void; export type OnEdgesDelete = (edges: Edge[]) => void; diff --git a/packages/react/src/utils/changes.ts b/packages/react/src/utils/changes.ts index cd148a6e..91a7a004 100644 --- a/packages/react/src/utils/changes.ts +++ b/packages/react/src/utils/changes.ts @@ -188,7 +188,10 @@ function applyChange(change: any, element: any, elements: any[] = []): any { ); */ -export function applyNodeChanges(changes: NodeChange[], nodes: NodeType[]): NodeType[] { +export function applyNodeChanges( + changes: NodeChange[], + nodes: NodeType[] +): NodeType[] { return applyChanges(changes, nodes) as NodeType[]; } @@ -212,7 +215,10 @@ export function applyNodeChanges(changes: NodeChan ); */ -export function applyEdgeChanges(changes: EdgeChange[], edges: EdgeType[]): EdgeType[] { +export function applyEdgeChanges( + changes: EdgeChange[], + edges: EdgeType[] +): EdgeType[] { return applyChanges(changes, edges) as EdgeType[]; }