def decorator(cls: type[SupportsFunc]) -> type[SupportsFunc]: class _Wrapper(cls): # type: ignore[valid-type, misc] # See https://github.com/python/mypy/issues/14458 def func(self) -> None: super().func() print("patched!") return _Wrapper