using Revise function testf(a)::NamedTuple{(:a, :b), Tuple{Union{Nothing, Int}, Int}} if a == 1 return (a=nothing, b=5) else return (a=5, b=5) end end q = testf(1) w = testf(2)