Dynamic output type of a node
Hi!
Curious whether it's possible to have the output type rely on the input type inside a node? Say I'd like to create a generic 'ForEach' node. This supports the (port) type 'Array', which has 'acceptTypes' set to a number of types that are arrays (e.g. MyCustomObjectsArray, OtherObjectsArray). This ForEach node would then accept both those array types and its output would be of type 'MyCustomObject' or 'OtherObject', depending on the input.
If we would have access to the connected inputs inside the 'outputs' property, we might be able to do this? Let me know if something is unclear.
Thank you very much for this awesome library. It looks awesome!
Thanks! If I'm understanding right, I think you should be able to do this already, and there's some upcoming features that can make it even easier. In the RootEngine when you create your resolveNodeTypes function, the first parameter of the function is the current node. That node object should have access to its connections that you could potentially use to make this determination. There's an upcoming feature that enables dynamic inputs/outputs, so the configuration itself can change depending on things like what's connected to a node. That feature might be useful for this use case. If the above doesn't cover your use-case let me know so I can make sure I'm fully understanding what you're trying to do.