ruff
7c826af6 - [ty] Fix TypedDict construction from existing TypedDict values (#22904)

Commit
26 days ago
[ty] Fix TypedDict construction from existing TypedDict values (#22904) Fix false positive errors when constructing a TypedDict from an existing TypedDict value using `**unpacking` or positional argument passing. Previously, `Data(**data)` and `Data(data)` where `data: Data` would incorrectly report missing required keys because the validation logic didn't recognize that the unpacked/passed TypedDict already contains all the required fields. This change: - Updates `validate_from_keywords` to handle `**unpacking` of TypedDict values by extracting and validating all fields from the unpacked type - Handles positional TypedDict arguments with a simple assignability check - Adds a bunch of tests for TypedDict construction patterns This PR handles intersections; union handling will be a separate change. Fixes https://github.com/astral-sh/ty/issues/2647
Author
Parents
Loading