David Peter
4887bdf205
[ty] Infer types for key-based access on TypedDicts ( #19763 )
...
## 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
2025-08-06 09:36:33 +02:00
..
2025-07-31 11:28:03 +01:00
2025-05-21 11:06:27 -04:00
2025-07-04 11:52:52 -07:00
2025-05-13 18:43:19 +02:00
2025-07-30 17:40:24 +02:00
2025-07-30 17:40:24 +02:00
2025-07-30 17:40:24 +02:00
2025-07-30 17:40:24 +02:00
2025-07-30 17:40:24 +02:00
2025-07-30 17:40:24 +02:00
2025-07-30 17:40:24 +02:00
2025-08-05 07:41:37 -07:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-06-27 12:40:33 +00:00
2025-06-02 10:52:26 +00:00
2025-06-02 10:52:26 +00:00
2025-07-02 17:34:56 +02:00
2025-07-02 17:34:56 +02:00
2025-07-02 17:34:56 +02:00
2025-07-23 08:24:12 -07:00
2025-07-08 16:16:50 +02:00
2025-07-18 23:50:29 +00:00
2025-07-18 23:50:29 +00:00
2025-07-08 20:29:07 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-07-30 17:40:24 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-07-08 19:51:09 +02:00
2025-07-08 19:51:09 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-06-24 20:27:37 +00:00
2025-06-24 20:27:37 +00:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-07-28 22:06:33 +00:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-06-09 00:40:05 +01:00
2025-05-21 15:38:56 -04:00
2025-06-09 00:40:05 +01:00
2025-05-13 18:43:19 +02:00
2025-05-21 18:02:39 -04:00
2025-05-21 18:02:39 -04:00
2025-05-16 06:57:26 +02:00
2025-08-01 12:20:32 -04:00
2025-05-15 11:39:14 -04:00
2025-05-15 11:39:14 -04:00
2025-05-14 11:13:41 -04:00
2025-05-14 11:13:41 -04:00
2025-05-14 11:13:41 -04:00
2025-05-14 11:13:41 -04:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-29 23:17:18 +00:00
2025-07-28 15:52:59 +02:00
2025-07-28 15:52:59 +02:00
2025-05-14 08:26:48 +02:00
2025-05-29 23:17:18 +00:00
2025-05-29 23:17:18 +00:00
2025-05-29 23:17:18 +00:00
2025-08-01 12:20:32 -04:00
2025-05-13 18:43:19 +02:00
2025-07-30 17:40:24 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-06-20 08:36:49 +05:30
2025-06-20 08:36:49 +05:30
2025-08-05 07:41:37 -07:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-07-24 08:24:26 +00:00
2025-08-06 09:36:33 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-06-24 18:02:05 -07:00
2025-08-05 16:35:08 -07:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-06-27 15:29:04 -04:00
2025-07-02 17:34:56 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-07-02 17:34:56 +02:00
2025-05-13 18:43:19 +02:00
2025-05-21 11:06:27 -04:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00
2025-05-13 18:43:19 +02:00