Skip to content

Instantly share code, notes, and snippets.

@xsteadfastx
Created February 14, 2019 08:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xsteadfastx/f542392cdd936faed1ee908a8e1e38a9 to your computer and use it in GitHub Desktop.
Save xsteadfastx/f542392cdd936faed1ee908a8e1e38a9 to your computer and use it in GitHub Desktop.
from typing import Dict, Union
QueryDict = Dict[str, Union[str, int, None]]
def foo(extra_query: QueryDict = None):
f = {"a":1, "b":2}
if extra_query:
f.update(extra_query)
foo(extra_query={"c": 3})
@xsteadfastx
Copy link
Author

the error is:

bar.py:7: error: Argument 1 to "update" of "dict" has incompatible type "Dict[str, Union[str, int, None]]"; expected "Mapping[str, int]"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment