nonmissingtype(::Type{Union{T, Missing}}) where {T} = T
nonmissingtype(::Type{Missing}) = Union{}
nonmissingtype(::Type{T}) where {T} = T
nonmissingtype(::Type{Any}) = Any
所以这应该可以解决你的问题
失踪
(刚刚
import
此函数来自
Base
)你有一个模板,可以在其他场景中实现类似的事情。如果它能满足你的要求,请告诉我。