Skip to content

Add support for dataclasses #4792

Closed
@gwk

Description

@gwk

I have added preliminary support for dataclasses in python/typeshed#1944.

These seem to work for declarations, but not for instantiation. For example:

@dataclass
class D0:
  x: int

d0 = D0(x=0)

The constructor is erroneously flagged, and points to the __init__ annotation for object:

error: Unexpected keyword argument "x" for "D0"
/Users/gwk/work/python/mypy/typeshed/stdlib/3/builtins.pyi:38:5: note: "D0" defined here

It appears that we need to teach mypy about dataclasses more deeply.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions