mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-29 03:02:27 +00:00
## Summary
This PR adds type inference for key-based access on `TypedDict`s and a
new diagnostic for invalid subscript accesses:
```py
class Person(TypedDict):
name: str
age: int | None
alice = Person(name="Alice", age=25)
reveal_type(alice["name"]) # revealed: str
reveal_type(alice["age"]) # revealed: int | None
alice["naem"] # Unknown key "naem" - did you mean "name"?
```
## Test Plan
Updated Markdown tests
|
||
|---|---|---|
| .. | ||
| .gitattributes | ||
| cli.md | ||
| configuration.md | ||
| environment.md | ||
| mypy_primer.md | ||
| rules.md | ||
| tracing-flamegraph.png | ||
| tracing.md | ||