-
-
Notifications
You must be signed in to change notification settings - Fork 37
Closed
Description
mypy_extensions.TypedDict is problematic for several reasons:
mypy_extensions.TypedDictis missing quite a few features that have been added totyping.TypedDictat runtime (and have been backported totyping_extensions.TypedDict).- I think the existence of both
mypy_extensions.TypedDictandtyping_extensions.TypedDicthas the potential to be pretty confusing for users. - It's quite annoying and error-prone that at typeshed, we have to remember to keep
typing._TypedDict,typing_extensions._TypedDictandmypy_extensions._TypedDictall in sync. Unfortunately, we can't put them all in_typeshedand have all three modules import_TypedDictfrom_typeshed, as the three classes all have slightly subtle differences. (E.g.mypy_extensions._TypedDictdoesn't have the__required_keys__and__optional_keys__ClassVars that bothtyping._TypedDictandtyping_extensions._TypedDicthave.) - Mypy now maintains its own copy of the
mypy-extensionsstubs anyway, so its stubs formypy_extensionsare no longer automatically updated with each typeshed sync. That means that even if we update the stubs formypy_extensions.TypedDictin typeshed (as we did in Improve__(r)or__signatures for TypedDict classes typeshed#10565), those updates are no longer of any benefit to mypy users unless mypy maintainers remember to copy across the changes to their forked version of themypy_extensionsstubs.
I propose that we deprecate mypy_extensions.TypedDict, and steer people towards typing_extensions.TypedDict instead: it's up-to-date with the features on typing.TypedDict, it's much more comprehensively tested, and it has up-to-date stubs.
Thoughts?
JelleZijlstra and davidfstr
Metadata
Metadata
Assignees
Labels
No labels