While it’s great that you like the solution of using an interface, what you actually want (and simulate this way) are union types. I hope I did not mean intersection types. I always get them mixed up. I know there were a few discussions about them previously. While I am personally not a fan of declaring union types explicitly I think they might have some value in combination with smart casts (is
-expressions).
Not sure if there has been any real discussion about this.
1 Like