orb icon indicating copy to clipboard operation
orb copied to clipboard

Make observer and subject utils generic

Open AlexIchenskiy opened this issue 1 year ago • 0 comments

It would be better to make observer and subject from observer.utils.ts to use generics instead of hard-coded types in their payload.

The current implementation provides an existing type IObserverDataPayload which is the mix of existing node data types that are then used by observers and subjects. A possible better implementation would be to provide custom payload data types for nodes and edges and use them to create a shared payload that could be used to parametrize observers while retrieving data. It is still not perfect and requires a lot of type guards to be used but it is already much more future-proof.

AlexIchenskiy avatar Mar 18 '24 13:03 AlexIchenskiy