Is possible possible to define a type signature such that `T` is a subtype of `S` except type `W` like `where {Union{} != T <: InlineString}`

This where definition doesn’t work.

function meh(::Type{T}) where {Union{} != T <: InlineString}

Is it possible to specify the type T such that it cannot be Union{}?

This is related to

Sadly, no - you can’t dispatch based on whether something is a Union or not. You’d dispatch on how the type is represented, instead of the type (or rather, the set of values the type represents) itself. There was some talk at juliacon some time ago where this was mentioned.

But what you can do is write a more specific function:

f(x::Fruit) = println("x is not an apple")
f(x::Apple) = println("x is an apple")
function meh(::T) where {T <: InlineString}

In this case it is impossible for T to be Union{}, since Union{} does not have any instances.

This is a bad example this is better

function meh(::Type{T}) where {T <: AbstractString}




You could just add another method for that case:

meh(::Type{Union{}}) = throw(MethodError(meh, (Union{},))

that’s not a bad solution. but I think the fundamental issue is that to packages used together broke my packages’ code and it really shouldn’t happen.

Yes, this is an issue with the package since it is committing type piracy. (Also, please don’t quote links to other posts instead of making them clickable, since copy-pasting is quite annoying on mobile)

mistake. didn’t mean to