Closed
Description
Bug Report
When using several dataclasses with common arguments is sometimes convenient to pass the arguments as a kwargs dict. but that will raise an error:
#error: Argument 1 to "Data" has incompatible type "**dict[str, object]";
To Reproduce
I put here a silly example where the **common dict may not be that useful, but keep in mind that this occurs in more complex scenarios where the dataclass for instnace may have 5 common arguments out of 7, and passing it like this it actually makes sense.
@dataclass
class Data:
car_id: int
car: str
Data(car_id=1, car="hola")
common = {"car_id":1, "car":"hola"}
Data(**common) #error: Argument 1 to "Data" has incompatible type "**dict[str, object]"; expected "str"
Expected Behavior
No error,
ofc talso in more complex variants of the same thing, as python accepts the arguments of it
Actual Behavior
#error: Argument 1 to "Data" has incompatible type "**dict[str, object]";
**Your Environment**
- Mypy version used: 1.15.0
- Mypy command-line flags: None
- Mypy configuration options from `mypy.ini` (and other config files): not much
- Python version used: 3.13