Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mypy issue: fix union types #12

Open
purarue opened this issue May 12, 2021 · 0 comments
Open

mypy issue: fix union types #12

purarue opened this issue May 12, 2021 · 0 comments

Comments

@purarue
Copy link
Owner

purarue commented May 12, 2021

Not totally sure how to fix the issue with binding a TypeVar with Union types across the same function signature:

$ mypy ./examples

examples/timedelta_serializer.py:81: error: Dict entry 0 has
incompatible type "Type[timedelta]": "Callable[[int], timedelta]";
expected "Type[Any]":
"Callable[[Union[str, int, float, bool, datetime, Dict[Any, Any]]], Any]"
 [dict-item]
            timedelta: from_seconds,
            ^
examples/timedelta_serializer.py:90: error: Dict entry 0 has
incompatible type "str": "Callable[[int], timedelta]"; expected "str":
"Callable[[Union[str, int, float, bool, datetime, Dict[Any, Any]]], Any]"
 [dict-item]
            "duration": from_seconds,
            ^
Found 2 errors in 1 file (checked 6 source files)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant