From a16c5c9bd5e6729b4aaa1c0a9e6ed4dd04bf9309 Mon Sep 17 00:00:00 2001 From: moklick Date: Sat, 17 Feb 2024 16:32:59 +0100 Subject: [PATCH] chore(types): cleanup --- examples/react/src/examples/DragHandle/index.tsx | 2 +- packages/react/src/types/changes.ts | 1 - packages/react/src/types/edges.ts | 14 +++++++------- packages/react/src/types/general.ts | 1 - packages/react/src/types/instance.ts | 1 - packages/svelte/src/lib/types/nodes.ts | 1 - packages/system/src/types/edges.ts | 1 - 7 files changed, 8 insertions(+), 13 deletions(-) diff --git a/examples/react/src/examples/DragHandle/index.tsx b/examples/react/src/examples/DragHandle/index.tsx index b76d8ae7..a7a75fcf 100644 --- a/examples/react/src/examples/DragHandle/index.tsx +++ b/examples/react/src/examples/DragHandle/index.tsx @@ -14,7 +14,7 @@ const initialNodes: Node[] = [ dragHandle: '.custom-drag-handle', style: { border: '1px solid #ddd', padding: '20px 40px' }, position: { x: 200, y: 200 }, - data: null, + data: {}, }, ]; diff --git a/packages/react/src/types/changes.ts b/packages/react/src/types/changes.ts index 9a5e8fe5..adcb484d 100644 --- a/packages/react/src/types/changes.ts +++ b/packages/react/src/types/changes.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ import type { XYPosition, Dimensions } from '@xyflow/system'; import type { Node, Edge } from '.'; diff --git a/packages/react/src/types/edges.ts b/packages/react/src/types/edges.ts index 4de6472e..dac682db 100644 --- a/packages/react/src/types/edges.ts +++ b/packages/react/src/types/edges.ts @@ -45,22 +45,22 @@ export type Edge< focusable?: boolean; }; -type SmoothStepEdgeType = Record> = Edge & { - type: 'smoothstep'; +type SmoothStepEdge = Record> = Edge< + EdgeData, + 'smoothstep' +> & { pathOptions?: SmoothStepPathOptions; }; -type BezierEdgeType = Record> = Edge & { - type: 'default'; +type BezierEdge = Record> = Edge & { pathOptions?: BezierPathOptions; }; -type StepEdgeType = Record> = Edge & { - type: 'step'; +type StepEdge = Record> = Edge & { pathOptions?: StepPathOptions; }; -export type BuiltInEdge = SmoothStepEdgeType | BezierEdgeType | StepEdgeType; +export type BuiltInEdge = SmoothStepEdge | BezierEdge | StepEdge; export type EdgeMouseHandler = (event: ReactMouseEvent, edge: EdgeType) => void; diff --git a/packages/react/src/types/general.ts b/packages/react/src/types/general.ts index 549921c2..0e1e1dc4 100644 --- a/packages/react/src/types/general.ts +++ b/packages/react/src/types/general.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ import { FitViewParamsBase, FitViewOptionsBase, diff --git a/packages/react/src/types/instance.ts b/packages/react/src/types/instance.ts index d34c23dc..1991580c 100644 --- a/packages/react/src/types/instance.ts +++ b/packages/react/src/types/instance.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-namespace */ import type { Rect, Viewport } from '@xyflow/system'; import type { Node, Edge, ViewportHelperFunctions } from '.'; diff --git a/packages/svelte/src/lib/types/nodes.ts b/packages/svelte/src/lib/types/nodes.ts index 7a0fe082..b3c572c7 100644 --- a/packages/svelte/src/lib/types/nodes.ts +++ b/packages/svelte/src/lib/types/nodes.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ import type { ComponentType, SvelteComponent } from 'svelte'; import type { NodeBase, NodeProps } from '@xyflow/system'; diff --git a/packages/system/src/types/edges.ts b/packages/system/src/types/edges.ts index 37c299e8..39dc97bd 100644 --- a/packages/system/src/types/edges.ts +++ b/packages/system/src/types/edges.ts @@ -1,6 +1,5 @@ import { Position } from './utils'; -// eslint-disable-next-line @typescript-eslint/no-explicit-any export type EdgeBase< EdgeData extends Record = Record, EdgeType extends string | undefined = string | undefined