Open
Description
Mypy doesn't respect TypedDict object changes. As an example, the following snippet
from typing import TypedDict
class A(TypedDict, total=False):
a: str
def func(a: str) -> None:
pass
data: A = {"a": "a"}
a = data.pop("a", "")
func(a, **data)
Raises the error:
error: "func" gets multiple values for keyword argument "a" [misc]
Formally, it is correctly, but it will be nice if mypy respects object keys changes. Especially in Unpack
case:
from typing import Unpack, TypedDict
class A(TypedDict, total=False):
a: str
def func(a: str) -> None:
pass
def func2(**data: Unpack[A]) -> None:
a = data.pop("a", "")
func(a, **data)