mirror of https://github.com/astral-sh/ruff
## Summary
Typecheck `get()`, `setdefault()`, `pop()` for `TypedDict`
```py
from typing import TypedDict
from typing_extensions import NotRequired
class Employee(TypedDict):
name: str
department: NotRequired[str]
emp = Employee(name="Alice", department="Engineering")
emp.get("name")
emp.get("departmen", "Unknown")
emp.pop("department")
emp.pop("name")
```
<img width="838" height="529" alt="Screenshot 2025-08-12 at 11 42 12"
src="https://github.com/user-attachments/assets/77ce150a-223c-4931-b914-551095d8a3a6"
/>
part of https://github.com/astral-sh/ty/issues/154
## Test Plan
Updated Markdown tests
---------
Co-authored-by: David Peter <mail@david-peter.de>
|
||
|---|---|---|
| .. | ||
| resources | ||
| src | ||
| tests | ||
| Cargo.toml | ||
| build.rs | ||
| mdtest.py | ||
| mdtest.py.lock | ||