Created
April 25, 2024 10:55
-
-
Save mypy-play/7cbe0ec77aad9859fd8e16343400bdd7 to your computer and use it in GitHub Desktop.
Shared via mypy Playground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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