xyflow / xyflow

React Flow | Svelte Flow - Powerful open source libraries for building node-based UIs with React (https://reactflow.dev) or Svelte (https://svelteflow.dev). Ready out-of-the-box and infinitely customizable.
https://xyflow.com
MIT License
21.54k stars 1.43k forks source link

[v12]: `pathOptions` not recognized anymore #4177

Open bcakmakoglu opened 1 month ago

bcakmakoglu commented 1 month ago

Describe the Bug

In v11 the typing for the Edge type allows pathOptions for the default edge-types (bezier, step and smoothstep) while in v12 pathOptions is not recognized anymore and will cause TypeScript to report an error for it even though the options are still taken and passed to the edge component.

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

Set up a basic v12 example and use sth like this

const initialEdges: Edge[] = [
  // Error: Object literal may only specify known properties, and pathOptions does not exist in type Edge
  { id: 'e1-2', type: 'smoothstep', pathOptions: { borderRadius: 100 }, source: '1', target: '2', animated: true },
];

Expected behavior

pathOptions should be a valid property on the default edge types previously mentioned.

Screenshots or Videos

No response

Platform

Additional context

No response

hedefalk commented 3 days ago

We have the same issue, need it for curvature setting and don't want to mess with ts-ignores. Working around with:

import { Edge as XYFlowEdge } from "@xyflow/react";
type Edge = XYFlowEdge & { pathOptions?: { curvature: number } };