Let's say I have an interface HasId and another HasResponsiblePerson.
I am now interested in an instance that implements both.
i.e.
typealias AssignableEntity = HasId & HasResponsiblePerson
class Foo {
val entity: AssignableEntity
}
But this fails because
Intersection types are only supported for definitely non-nullable types: left part should be a type parameter with nullable bounds
I could, of course, just define a new interface
interface AssignableEntity: HasId, HasResponsiblePerson
but then I have to define new interfaces every time I come across a new combination of interfaces I am interested in, and we end up with a ton of mostly useless interfaces.
Is there a way to do what I want?