From a20483452565b0e50af5c22c94836984d34e2e20 Mon Sep 17 00:00:00 2001 From: moklick Date: Sat, 16 May 2020 01:12:46 +0200 Subject: [PATCH] refactor(types): use interfaces --- src/types/index.ts | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/types/index.ts b/src/types/index.ts index 96184f60..bdfb71a4 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -13,22 +13,11 @@ export enum Position { Bottom = 'bottom', } -export type XYPosition = { +export interface XYPosition { x: number; y: number; -}; - -export enum GridType { - Lines = 'lines', - Dots = 'dots', } -export type HandleType = 'source' | 'target'; - -export type NodeTypesType = { [key: string]: React.ReactNode }; - -export type EdgeTypesType = NodeTypesType; - export interface Dimensions { width: number; height: number; @@ -41,12 +30,6 @@ export interface Box extends XYPosition { y2: number; } -export interface SelectionRect extends Rect { - startX: number; - startY: number; - draw: boolean; -} - export interface Node { id: ElementId; position: XYPosition; @@ -71,6 +54,23 @@ export interface Edge { animated?: boolean; } +export enum GridType { + Lines = 'lines', + Dots = 'dots', +} + +export type HandleType = 'source' | 'target'; + +export type NodeTypesType = { [key: string]: React.ReactNode }; + +export type EdgeTypesType = NodeTypesType; + +export interface SelectionRect extends Rect { + startX: number; + startY: number; + draw: boolean; +} + export interface EdgeProps { sourceX: number; sourceY: number; @@ -142,10 +142,10 @@ type OnLoadParams = { export type OnLoadFunc = (params: OnLoadParams) => void; -export type Connection = { +export interface Connection { source: ElementId | null; target: ElementId | null; -}; +} export type OnConnectFunc = (connection: Connection) => void;