ruff/crates/ty
David Peter 98df62db79
[ty] Validate writes to TypedDict keys (#19782)
## 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
2025-08-06 15:19:13 -07:00
..
docs [ty] Validate writes to TypedDict keys (#19782) 2025-08-06 15:19:13 -07:00
src [ty] Support LSP client settings (#19614) 2025-08-06 18:37:21 +05:30
tests [ty] Implement streaming for workspace diagnostics (#19657) 2025-08-04 09:34:29 +00:00
build.rs [ty] Fix server version (#19284) 2025-07-14 09:06:34 +02:00
Cargo.toml [ty] Support LSP client settings (#19614) 2025-08-06 18:37:21 +05:30
CONTRIBUTING.md Fix link typo in ty's CONTRIBUTING.md (#18923) 2025-06-24 20:23:31 +00:00
README.md [ty] contribution guide (#18061) 2025-05-13 10:55:01 +02:00

ty

ty is an extremely fast type checker. Currently, it is a work-in-progress and not ready for production use.

The Rust code for ty lives in this repository; see CONTRIBUTING.md for more information on contributing to ty.

See the ty repo for ty documentation and releases.