Skip to content

Commit 9ff1cf9

Browse files
committed
Address misc review comments
1 parent caafa17 commit 9ff1cf9

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

docs/source/typed_dict.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,5 +334,5 @@ to use inline TypedDict syntax. For example:
334334
type Z = {"a": int, "b": int} # same as above (Python 3.12+ only)
335335
336336
This restriction does not apply to the :pep:`764` syntax.
337-
Also, due to incompatibility with runtime type-checking it is strongly recommended
337+
Also, due to incompatibility with runtime type-checking, it is strongly recommended
338338
to *not* use legacy inline syntax in union types.

test-data/unit/check-typeddict.test

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3821,6 +3821,15 @@ def f():
38213821
[builtins fixtures/dict.pyi]
38223822
[typing fixtures/typing-full.pyi]
38233823

3824+
[case testTypedDictInlinePEP764UsesExtensionSyntax]
3825+
# flags: --enable-incomplete-feature=NewInlineTypedDict
3826+
from typing import TypedDict
3827+
x: TypedDict[{'name': str, 'production': {'location': str}}] # E: Legacy inline TypedDict is experimental, must be enabled with --enable-incomplete-feature=InlineTypedDict \
3828+
# N: Did you mean TypedDict[...]?
3829+
reveal_type(x) # N: Revealed type is "TypedDict({'name': builtins.str, 'production': TypedDict({'location': builtins.str})})"
3830+
[builtins fixtures/dict.pyi]
3831+
[typing fixtures/typing-typeddict.pyi]
3832+
38243833
# ReadOnly
38253834
# See: https://peps.python.org/pep-0705
38263835

0 commit comments

Comments
 (0)