-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
singledispatch(method).register should accept UnionType #13560
Comments
I don't think there's a way to express this yet, although the Type Form PEP (PEP 747) might change that. Our best bet for now is an |
What do you mean? Lines 159 to 160 in e6165ea
and Lines 179 to 180 in e6165ea
like @overload
-def register(self, cls: type[Any], func: None = None) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ...
+def register(self, cls: type[Any] | UnionType, func: None = None) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ... |
I didn't realize that we can use |
That’s why I started this issue with
haha! I made a PR. |
This works perfectly fine at runtime:
but mypy says (playground link)
The text was updated successfully, but these errors were encountered: