Would an @overload-related fallback decorator that catches everything not assignable to an existing overload be feasible? For example, consider the following:
from typing import overload
@overload
def spam(ham: int) -> str: ...
@overload
def spam(ham: str) -> int: ...
@overload_fallback
def spam(ham: Any) -> None: ...
def spam(ham: int | str | bytes | bytearray) -> str | int | None: ...
Then spam(b"12") would be inferred as None since (ham: bytes) is not assignable to (ham: int) or (ham: str), but it is assignable to (ham: int | str | bytes | bytearray). Meanwhile, spam([0]) would be a type-checker error since [0] is not int | str | bytes | bytearray.
More precisely, if a call to an overloaded function cannot possibly match any overloads, but it does match the annotation for the implementation, then its return type would be inferred to the return type of the @overload_fallback definition.
The motivating case for this idea is essentially this Stack Overflow question, in which a user wanted to return a float when all four arguments to a function are float and np.ndarray if any of the arguments are np.ndarray. In that case, a correct annotation would require four extra overloads; you can cheat with a type checker directive, but that messes up inference.
(I think this specification is still light on precision since there’s some weirdness around union arguments.)