Skip to content

Instantly share code, notes, and snippets.

@mypy-play
Created September 19, 2021 03:07
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 mypy-play/1cbdc48546f3a1bc61476936c3dc9af7 to your computer and use it in GitHub Desktop.
Save mypy-play/1cbdc48546f3a1bc61476936c3dc9af7 to your computer and use it in GitHub Desktop.
Shared via mypy Playground
from typing import Generic, TypeVar, Mapping
T = TypeVar("T")
T2 = TypeVar("T2")
class A(dict[T, T2]):
...
def foo(**i: float) -> None:
...
a: A[str, str]
d = {"a": "b"}
foo(**a)
foo(**d) # error: Argument 1 to "foo" has incompatible type "**Dict[str, str]"; expected "float"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment