How to adjust definition of f so it works for both As and Bs types in the following code:
struct A end
struct B{b} end
va = Vector{Union{A, Missing}}()
vb = Vector{Union{B, Missing}}()
f(v::Vector{Union{t, Missing}}, i::t) where t = nothing
f(va, A())
f(vb, B{:b}())
Of course I would like to avoid i::Any in the method definition.
I don’t think you can combine these into a single method signature, but someone may suggest a solution. In any case, I think that using two signatures is more readable.
It is possible that you want AbstractVector instead of Vector, unless you have a very compelling reason.
Finally, it is not clear from your example if you want to do this, but conditioning semantics on container types is not good practice IMO. Code should work the same for Vector{Any} and Vector{T}, if the elements are otherwise identical. Also, if vb contains various B{T}s, you may not get any performance gains from narrowing the element type since B is not a concrete type.