Closed as not planned
Closed as not planned
Description
Bug Report
Mypy has support for declaring kwargs as **kwargs: Unpack[SomeTypedDict]
.
However, sometimes for dicts with uniform value types, it's more convenient to declare them in terms of dict[Literal["key", "another"], ...]
. Other times it's a pragmatic work-around to the lack of support for @final
declaration for TypedDict
(#7981).
To Reproduce
This should pass mypy checking:
from typing import Literal, Unpack
def example(**kwargs: Unpack[dict[Literal["test"], int]]):
# ^^^^
pass
example(test=123)
Actual Behavior
Rejected by mypy with the following error:
error: Unpack item in ** argument must be a TypedDict [misc]
Your Environment
- Mypy version used: 1.10.0
- Python version used: 3.12.3