Skip to content

Instantly share code, notes, and snippets.

@mypy-play
Created March 9, 2026 14:01
Show Gist options
  • Select an option

  • Save mypy-play/51d956ce6d83f17a64b31707b78eecb2 to your computer and use it in GitHub Desktop.

Select an option

Save mypy-play/51d956ce6d83f17a64b31707b78eecb2 to your computer and use it in GitHub Desktop.
Shared via mypy Playground
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