Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Unreleased

- Align the implementation of `TypedDict` with the implementation in the
standard library on Python 3.9 and higher.
`typing_extensions.TypedDict` is now a function instead of a class. The
private functions `_check_fails`, `_dict_new`, and `_typeddict_new`
have been removed. `is_typeddict` now returns `False` when called with
`TypedDict` itself as the argument. Patch by Jelle Zijlstra.
- Declare support for Python 3.12. Patch by Jelle Zijlstra.
- Fix tests on Python 3.13, which removes support for creating
`TypedDict` classes through the keyword-argument syntax. Patch by
Expand Down
12 changes: 12 additions & 0 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,12 @@ Special typing primitives

Support for the ``__orig_bases__`` attribute was added.

.. versionchanged:: 4.7.0

``TypedDict`` is now a function rather than a class.
This brings ``typing_extensions.TypedDict`` closer to the implementation
of :py:mod:`typing.TypedDict` on Python 3.9 and higher.

.. class:: TypeVar(name, *constraints, bound=None, covariant=False,
contravariant=False, infer_variance=False, default=...)

Expand Down Expand Up @@ -629,6 +635,12 @@ Functions

.. versionadded:: 4.1.0

.. versionchanged:: 4.7.0

:func:`is_typeddict` now returns ``False`` when called with
:data:`TypedDict` itself as the argument, consistent with the
behavior of :py:func:`typing.is_typeddict`.

.. function:: reveal_type(obj)

See :py:func:`typing.reveal_type`. In ``typing`` since 3.11.
Expand Down
6 changes: 5 additions & 1 deletion src/_typed_dict_test_helper.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

from typing import Generic, Optional, T
from typing_extensions import TypedDict
from typing_extensions import TypedDict, Annotated, Required


# this class must not be imported into test_typing_extensions.py at top level, otherwise
Expand All @@ -16,3 +16,7 @@ class Foo(TypedDict):

class FooGeneric(TypedDict, Generic[T]):
a: Optional[T]


class VeryAnnotated(TypedDict, total=False):
a: Annotated[Annotated[Annotated[Required[int], "a"], "b"], "c"]
Loading