Skip to content

Instantly share code, notes, and snippets.

@mypy-play
Created April 25, 2024 10:55
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/7cbe0ec77aad9859fd8e16343400bdd7 to your computer and use it in GitHub Desktop.
Save mypy-play/7cbe0ec77aad9859fd8e16343400bdd7 to your computer and use it in GitHub Desktop.
Shared via mypy Playground
from typing import TypeVar, TypedDict, Generic
VarT = TypeVar("VarT", bound=dict)
class MyCls(Generic[VarT]):
def sneed(self, t: VarT):
print(t)
class MyDict(TypedDict):
a: int
class Child(MyCls[MyDict]):
pass
Child().sneed({"a": 1})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment