![](https://secure.gravatar.com/avatar/833c1ef94aebf738851577a5cb0b71e7.jpg?s=120&d=mm&r=g)
19 Oct
2022
19 Oct
'22
8:04 a.m.
I see that both mypy and pyright both reject TypedDict being constructed with a dict comprehension, which from a static typing perspective is understandable. I do question if it's the correct behavior though. I have multiple dynamic typing cases where I construct a TypedDict using a dict comprehension a la: TypedDict("TD", {n: t for n, t in ...}). I propose static type checkers interpret this as equivalent to dict[Any, Any], and not flag it as an error (and not show red underlines in various IDEs), as there is nothing I can see in the documentation to prohibit it and works at runtime as expected.