@Zac Sweers I do want that, but for another use case. For this case, I need a sort of a sum type that allows defining multiple interface constraints.
data class RootData() : HasId, HasName, HasProp1, HasProp2
The idea is to select only partial data without having to map from data type to another. So, I could select only
HasId
and
HasProp1
without having to ask for the whole
RootData
object. The interface solution doesn’t work well because then
RootData
would need to implement
Data
interface which would couple data to all the places consuming it (I would prefer the data to not be aware where it is consumed).