Being an extern, haxe.extern.EitherType doesn’t have potential runtime implications like haxe.ds.Either. You can actually see it’s quite a simple implementation.
Personally, I think the syntax of the nested types is a little messy, and makes for illegible error messages. So it’s possible to write your own abstracts to describe 3, 4, or N possibilities.
abstract AnyOf3<T1, T2, T3>(Dynamic) from T1 to T1 from T2 to T2 from T3 to T3 {}
abstract AnyOf4<T1, T2, T3, T4>(Dynamic) from T1 to T1 from T2 to T2 from T3 to T3 from T4 to T4 {}
And / or you can also alias them to something sensible:
In this case with Blob constructor, wouldn’t it be preferable to use @:overload?
Are there clear guidelines on what and when we should choose between @:overload, EitherType, or Abstract for externs?