@@ -508,10 +508,10 @@ checks::
508508
509509 details: MovieWithYear = {"name": "Kill Bill Vol. 1", "year": 2003}
510510 movie: Movie = details # Not OK. 'year' is not required in 'Movie',
511- # so it shouldn't be required in 'MovieWithYear' either
511+ # but it is required in 'MovieWithYear'
512512
513- Given that `` 'year' `` is not-required and non-read-only in A ( ``Movie ``),
514- it shouldn’t be required in B (`` MovieWithYear ``) either, according to this rule:
513+ where `` MovieWithYear `` (B) is not assignable to ``Movie `` (A)
514+ according to this rule:
515515
516516 * For each non-required key in ``A ``, if the item is not read-only in ``A ``,
517517 the corresponding key is not required in ``B ``.
@@ -614,7 +614,7 @@ apply to extra items, following the same rationale from the `typing spec
614614 generate false positive errors for idiomatic code.
615615
616616Some operations, including indexed accesses and assignments with arbitrary str keys,
617- can be allowed due to the TypedDict being :term: `typing:assignable ` to
617+ may be allowed due to the TypedDict being :term: `typing:assignable ` to
618618``Mapping[str, VT] `` or ``dict[str, VT] ``. The two following sections will expand
619619on that.
620620
@@ -644,15 +644,15 @@ For example::
644644 int_mapping: Mapping[str, int] = extra_int # Not OK. 'int | str' is not assignable with 'int'
645645 int_str_mapping: Mapping[str, int | str] = extra_int # OK
646646
647- Type checkers should be able to infer the precise signatures of ``values() ``,
648- `` items() ``, etc. on such TypedDict types::
647+ Type checkers should infer the precise signatures of ``values() `` and `` items() ``
648+ on such TypedDict types::
649649
650650 def foo(movie: MovieExtraInt) -> None:
651651 reveal_type(movie.items()) # Revealed type is 'dict_items[str, str | int]'
652652 reveal_type(movie.values()) # Revealed type is 'dict_values[str, str | int]'
653653
654- By extension of this assignability rule, indexed accesses with arbitrary str keys
655- can be allowed as long as ``extra_items `` or ``closed=True `` is specified.
654+ By extension of this assignability rule, type chekcers may allow indexed accesses
655+ with arbitrary str keys when ``extra_items `` or ``closed=True `` is specified.
656656For example::
657657
658658 def bar(movie: MovieExtraInt, key: str) -> None:
@@ -662,7 +662,7 @@ For example::
662662
663663Defining the type narrowing behavior for TypedDict is out-of-scope for this PEP.
664664This leaves flexibility for a type checker to be more/less restrictive about
665- indexed accesses with arbitrary str keys. For example, a type checker might opt
665+ indexed accesses with arbitrary str keys. For example, a type checker may opt
666666for more restriction by requiring an explicit ``'x' in d `` check.
667667
668668Interaction with dict[str, VT]
0 commit comments