f(x::MyType{T, S}) where (T || S) <: Foo?

If this is really the only problem, just use a union type:

const MyTypeFoo = Union{MyType{Foo},MyType{<:FooBarBaz,Foo}}

f(x::MyTypeFoo) = 5

(As originally suggested by @uniment!)

2 Likes