mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-04 23:50:31 +00:00
![]() ## Summary Validates writes to `TypedDict` keys, for example: ```py class Person(TypedDict): name: str age: int | None def f(person: Person): person["naem"] = "Alice" # error: [invalid-key] person["age"] = "42" # error: [invalid-assignment] ``` The new specialized `invalid-assignment` diagnostic looks like this: <img width="1160" height="279" alt="image" src="https://github.com/user-attachments/assets/51259455-3501-4829-a84e-df26ff90bd89" /> ## Ecosystem analysis As far as I can tell, all true positives! There are some extremely long diagnostic messages. We should truncate our display of overload sets somehow. ## Test Plan New Markdown tests |
||
---|---|---|
.. | ||
corpus | ||
mdtest | ||
primer | ||
README.md |
Markdown files within the mdtest/
subdirectory are tests of type inference and type checking;
executed by the tests/mdtest.rs
integration test.
See crates/ty_test/README.md
for documentation of this test format.