Treat TypedDict as structured types w.r.t subclassing

This typically isn’t a problem because type narrowing doesn’t affect library interfaces or type stubs. Unless you’re using different type checkers on the same code base (which isn’t typical), the differences in type narrowing behavior shouldn’t be an issue.

I would push back that it isn’t typical to see different type checkers used on the same code base. Each type checker has distinct strengths and weaknesses as well as levels of integration with tools such as IDEs. At least in my anecdotal experience at a large company, most code bases I encounter run against multiple type checkers to ensure consistent behavior regardless of developer and their environment. This may be atypical of public code bases, but at least the private environments I have worked in have consistently used multiple type checkers.

4 Likes