chrisjpatty / flume

Extract logic from your apps with a user-friendly node editor powered by React.
https://flume.dev
MIT License
1.46k stars 147 forks source link

Type 'string' is not comparable to type 'NodeType' #223

Closed Z8MB1E closed 1 year ago

Z8MB1E commented 1 year ago

Hey there, let me start by giving you huge props on an awesome, clean, and useful tool for building flow-based programming node graphs that are compatible with React and, now, TypeScript.

Now onto the bug. While attempting to follow your tutorial on flume.dev, I attempted to verify and implement the necessary types during the process. However, when I got to the resolveNodes section, I found that the required type of NodeResolver did not allow for its nodeType parameter (using the NodeType class) to use the following switch statement. See the screenshot below:

image

The type error disappeared when I replaced switch (nodeType) with switch (nodeType.type), but the program ceased functioning. When I switched it back (and once again received the error), the nodegraph started working again.

Any thoughts on this? Thanks again for your help!

Z8MB1E commented 1 year ago

Ha, nevermind! It was my own error... I was checking nodeType when I should have been checking node.type! My apologies - thanks again!

chrisjpatty commented 1 year ago

No problem glad you got it sorted out! How has your experience been using the typescript types? Did they feel complete? Would love any feedback on how well they function in practice.