mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-21 07:41:53 +00:00
[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:
parent
fa711fa40f
commit
b96929ee19
3 changed files with 27 additions and 2 deletions
|
@ -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 -->
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue