Open KotlinIsland opened 2 months ago
doesn't necessarily need to be a TypedDict
, i don't see why it shouldn't work if oit's bound to Mapping[str, object]
:
from typing import Unpack
from collections.abc import Mapping
class Foo[T: Mapping[str, object]]:
def f(self, **kwargs: Unpack[T]) -> T: ...
_ = Foo[Mapping[str, object]]().f(a='asdf')
doesn't necessarily need to be a
TypedDict
, i don't see why it shouldn't work if oit's bound toMapping[str, object]
:from typing import Unpack from collections.abc import Mapping class Foo[T: Mapping[str, object]]: def f(self, **kwargs: Unpack[T]) -> T: ... _ = Foo[Mapping[str, object]]().f(a='asdf')
class AmongusMapping(Mapping[str, str]):...
Foo[AmongusMapping]().f(a="asdf")
it should still be able to unpack them even if it's a different subtype of mapping imo
because
TypedDict
is structural, this should allow allTypedDict
s to work