[ty] Extend TypedDict constructor validation to union calls#24450
Draft
charliermarsh wants to merge 2 commits intomainfrom
Draft
[ty] Extend TypedDict constructor validation to union calls#24450charliermarsh wants to merge 2 commits intomainfrom
charliermarsh wants to merge 2 commits intomainfrom
Conversation
Typing conformance resultsNo changes detected ✅Current numbersThe percentage of diagnostics emitted that were expected errors held steady at 87.94%. The percentage of expected errors that received a diagnostic held steady at 83.21%. The number of fully passing files held steady at 79/133. |
Memory usage reportMemory usage unchanged ✅ |
|
8c14980 to
aa90e92
Compare
a636d6f to
a4215a8
Compare
aa90e92 to
a11a96f
Compare
a11a96f to
97e474c
Compare
a4215a8 to
1f82053
Compare
97e474c to
c168f53
Compare
1f82053 to
148dd38
Compare
c168f53 to
adc2c96
Compare
AlexWaygood
reviewed
Apr 7, 2026
148dd38 to
3ecf163
Compare
adc2c96 to
86c7916
Compare
f6f9db6 to
9aabddc
Compare
86c7916 to
014f339
Compare
49cccb4 to
af3d7cf
Compare
95f73c5 to
89c461e
Compare
af3d7cf to
a035944
Compare
39d13a2 to
c58b08e
Compare
charliermarsh
added a commit
that referenced
this pull request
Apr 9, 2026
## Summary
<!-- What's the purpose of the change? What does it do, and why? -->
This PR adds a synthesized `__init__` method for `TypedDict` that is
used in server for hover.
The new method is not used for type checking.
The reason is that the current sophisticated validation logic has better
UX than normal argument matching.
The `__init__` method has two bindings right now:
```
class Movie(TypedDict):
title: str
year: int
class Movie(
__map: Movie,
/,
*,
title: str = ...,
year: int = ...
)
class Movie(
*,
title: str = ...,
year: int = ...
)
```
I removed the previous TODO to use synthesized method for type checking
since this is being implemented with another solution.
#24450.
## Test Plan
<!-- How was it tested? -->
---------
Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
4ff83f4 to
a81ac5f
Compare
c58b08e to
d49787c
Compare
ibraheemdev
pushed a commit
that referenced
this pull request
Apr 15, 2026
## Summary
<!-- What's the purpose of the change? What does it do, and why? -->
This PR adds a synthesized `__init__` method for `TypedDict` that is
used in server for hover.
The new method is not used for type checking.
The reason is that the current sophisticated validation logic has better
UX than normal argument matching.
The `__init__` method has two bindings right now:
```
class Movie(TypedDict):
title: str
year: int
class Movie(
__map: Movie,
/,
*,
title: str = ...,
year: int = ...
)
class Movie(
*,
title: str = ...,
year: int = ...
)
```
I removed the previous TODO to use synthesized method for type checking
since this is being implemented with another solution.
#24450.
## Test Plan
<!-- How was it tested? -->
---------
Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes astral-sh/ty#3224.