You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The dataclass decorator in the typeshed package has an inconsistency in its overloads. Specifically, when cls is passed explicitly as None, it is unclear whether additional arguments (e.g., init, repr, etc.) should be allowed or not. The current implementation allows passing cls=None alongside additional arguments, but this usage is not explicitly documented or validated.
Expected Behavior
The overloads should clearly define and document the behavior of cls=None when additional arguments are provided:
If allowed, the typing should reflect that explicitly.
If not allowed, the implementation should prevent or warn against such usage.
Current Behavior
Passing cls=None with arguments like kw_only=True is allowed, but this behavior is not described in the overloads. For example:
decorator=dataclass(None, kw_only=True)
@decoratorclassMyClass:
x: int
The above works but is ambiguous in terms of type checking and intended usage.
The text was updated successfully, but these errors were encountered:
The dataclass decorator in the typeshed package has an inconsistency in its overloads. Specifically, when cls is passed explicitly as None, it is unclear whether additional arguments (e.g., init, repr, etc.) should be allowed or not. The current implementation allows passing cls=None alongside additional arguments, but this usage is not explicitly documented or validated.
Expected Behavior
The overloads should clearly define and document the behavior of cls=None when additional arguments are provided:
If allowed, the typing should reflect that explicitly.
If not allowed, the implementation should prevent or warn against such usage.
Current Behavior
Passing cls=None with arguments like kw_only=True is allowed, but this behavior is not described in the overloads. For example:
The above works but is ambiguous in terms of type checking and intended usage.
The text was updated successfully, but these errors were encountered: