[ty] Disallow typing.TypedDict in type expressions (#19777)

## Summary

Disallow `typing.TypedDict` in type expressions.

Related reference: https://github.com/python/mypy/issues/11030

## Test Plan

New Markdown tests, checked ecosystem and conformance test impact.
This commit is contained in:
David Peter 2025-08-06 15:58:35 +02:00 committed by GitHub
parent fa711fa40f
commit b96929ee19
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 27 additions and 2 deletions

View file

@ -375,6 +375,17 @@ reveal_type(Message.__required_keys__) # revealed: @Todo(Support for `TypedDict
msg.content
```
## Error cases
### `typing.TypedDict` is not allowed in type expressions
```py
from typing import TypedDict
# error: [invalid-type-form] "The special form `typing.TypedDict` is not allowed in type expressions."
x: TypedDict = {"name": "Alice"}
```
## Diagnostics
<!-- snapshot-diagnostics -->