Skip to content

Conversation

@christian-byrne
Copy link
Contributor

Summary

Fixes Comfy-Org/ComfyUI_frontend#4714 - Resolves the type safety issue where SlotShape is a subset of RenderShape but the type system didn't reflect this properly.

Changes

  • Updated INodeSlot.shape to use SlotShape instead of RenderShape
  • Added validateSlotShape() function for backward compatibility
  • Added runtime validation in addInput()/addOutput() methods
  • Added migration logic in configure() for legacy workflows
  • Updated rendering code to use proper SlotShape values
  • Removed unsafe type assertions

Backward Compatibility

The solution maintains full backward compatibility:

  • Legacy workflows with RenderShape.ROUND or RenderShape.CARD are automatically migrated
  • Invalid shape values are converted to sensible defaults with console warnings
  • All existing tests pass without modification

Testing

  • ✅ All existing tests pass
  • ✅ TypeScript compilation is clean
  • ✅ Verified legacy workflow migration works correctly
  • ✅ Runtime validation prevents future invalid shapes

… #931)

- Update INodeSlot interface to use SlotShape instead of RenderShape for type safety
- Add validateSlotShape() function to handle backward compatibility with legacy workflows
- Add runtime validation in addInput()/addOutput() methods to convert invalid shapes
- Add migration logic in configure() method for deserializing legacy workflows
- Update rendering code to use SlotShape values and provide proper fallbacks
- Remove unsafe type assertions that compromised type safety

The solution maintains full backward compatibility while fixing the type system
to accurately reflect that slots only support a subset of RenderShape values.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DevTask] Type disparity between SlotShape vs RenderShape

2 participants