@@ -3094,7 +3094,7 @@ def __new__(cls, name, bases, ns, total=True, closed=None,
30943094 raise TypeError ('Cannot inherit from both a TypedDict type '
30953095 'and a non-TypedDict base class' )
30963096 if closed is not None and extra_items is not NoExtraItems :
3097- raise TypeError (f"Cannot use both closed and extra_items" )
3097+ raise TypeError (f"Closed cannot be specified with extra_items" )
30983098
30993099 if any (issubclass (b , Generic ) for b in bases ):
31003100 generic_base = (Generic ,)
@@ -3274,7 +3274,7 @@ class DatabaseUser(TypedDict):
32743274 id: ReadOnly[int] # the "id" key must not be modified
32753275 username: str # the "username" key can be changed
32763276
3277- The * closed* argument controls whether the TypedDict allows additional
3277+ The closed argument controls whether the TypedDict allows additional
32783278 non-required items during inheritance and assignability checks.
32793279 If closed=True, the TypedDict is closed to additional items::
32803280
@@ -3284,15 +3284,21 @@ class Point3D(Point2D):
32843284
32853285 Passing closed=False explicitly requests TypedDict's default open behavior.
32863286 If closed is not provided, the behavior is inherited from the superclass.
3287+ A type checker is only expected to support a literal False or True as the
3288+ value of the closed argument.
32873289
3288- The * extra_items* argument can instead be used to specify the type of
3289- additional non-required keys::
3290+ The extra_items argument can instead be used to specify the assignable type
3291+ of unknown non-required keys::
32903292
32913293 Point2D = TypedDict('Point2D', {'x': int, 'y': int}, extra_items=int)
32923294 class Point3D(Point2D):
32933295 z: int # OK
32943296 label: str # Type checker error
32953297
3298+ The extra_items argument is also inherited through subclassing. It is unset
3299+ by default, and it may not be used with the closed argument at the same
3300+ time.
3301+
32963302 See PEP 728 for more information about closed and extra_items.
32973303 """
32983304 ns = {'__annotations__' : dict (fields )}
0 commit comments