Created
March 9, 2026 14:01
-
-
Save mypy-play/51d956ce6d83f17a64b31707b78eecb2 to your computer and use it in GitHub Desktop.
Shared via mypy Playground
This file contains hidden or 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 Protocol, TypedDict, Unpack, Any | |
| class Factory(Protocol): | |
| def __call__(self, **kwargs: Any) -> Any: | |
| pass | |
| def use_factory(factory: Factory): | |
| pass | |
| class MyParams(TypedDict): | |
| a: int | |
| class MyFactory(Protocol): | |
| def __call__(self, **kwargs: Unpack[MyParams]) -> Any: | |
| pass | |
| def mypy_fails(factory: MyFactory): | |
| use_factory(factory) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment