
Thank you for your answer and sorry for the confusion. I wasn't asking about the implementation, I was asking how you would annotate such use-case using @dataclass_transform ? I'm a little confused, as your answer does not use dataclass_transform at all, so type checker would not detect that A, B & C are dataclass-like. Should the code be annotated as ? : ``` @overload @dataclass_transform def my_dataclass(cls: None = ..., **options: Any,) -> Callable[[_ClsT], _ClsT]: ... @overload @dataclass_transform def my_dataclass(cls: Callable[..., _ClsT], **options: Any,) -> type[_ClsT]: ... def my_dataclass(cls = None, **options: Any): ``` Or: ``` @overload def my_dataclass(cls: None = ..., **options: Any,) -> Callable[[_ClsT], _ClsT]: ... @overload def my_dataclass(cls: Callable[..., _ClsT], **options: Any,) -> type[_ClsT]: ... @dataclass_transform def my_dataclass(cls = None, **options: Any): ``` In the current proposal, it's not obvious to me what is the answer. Or even if this is supported. This is why I suggested it would be nice to specify this in the PEP and give an example. (you can ignore the section on Intersection, I was just showing an alternative syntax to @dataclass_transform which would make such use-case more explicit, using notation described in https://github.com/python/typing/issues/213)