Restricting method dispatch to a few concrete types

You just want where T <: Union{T1,T2}. Concrete types can’t have subclasses.