
Hi Étienne, Thanks for your feedback! The code below worked for me. Is this what you were aiming for? Was the use of Intersection important to your question? If so, was the Dataclass type supposed to represent the dataclass-like changes made by the my_dataclass decorator? That seems unnecessary to me, since dataclass_transform is already trying to describe those changes. If I'm missing your point, can you provide a more complete example? -Erik ```python from typing import Callable, Any, TypeVar, overload _ClsT = TypeVar("_ClsT") @overload def my_dataclass(cls: None = ..., **options: Any,) -> Callable[[_ClsT], _ClsT]: ... @overload def my_dataclass(cls: Callable[..., _ClsT], **options: Any,) -> type[_ClsT]: ... def my_dataclass(cls: Callable[..., _ClsT] | None = None, **options: Any) -> Callable[..., _ClsT]: # The implementation of the decorator was borrowed from dataclass def wrap(cls): return _process_class(cls, **options) # See if we're being called as @dataclass or @dataclass(). if cls is None: # We're called with parens. return wrap # We're called as @dataclass without parens. return wrap(cls) def _process_class(cls, **options: Any): return cls @my_dataclass class A: x: int @my_dataclass() class B: x: int @my_dataclass(frozen=True) class C: x: int ```