from typing import ParamSpec, Callable
P = ParamSpec("P")
class Thing:
value: int
def deco(fn: Callable[P, None]) -> Callable[P, None]:
raise Exception
@deco
def f() -> None:
state: Thing
f
if state.value:
class C:
def f2(self) -> None: ...
reveal_type(state.value) # two outputs: `int` and `Any`
playground