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

Svelte: Fix Node event types #4195

Closed RedPhoenixQ closed 2 weeks ago

RedPhoenixQ commented 3 weeks ago

Using createEventDispatcher from another imported function seems to break the svelte types and thus none of the node events where typed.

This PR fixes the issue by sharing only the types and not a create function. The NodeEventMap type was placed in the types directory to be accessible for both NodeWrapper and NodeSelection.

I noticed this when upgrading past 0.0.40 were there was a breaking change but no type errors to alert me were and what the new types were

moklick commented 3 weeks ago

Thanks for your PR @RedPhoenixQ we will check it next week.