Skip to content

[ty] Support inheriting from functional TypedDict#24227

Merged
charliermarsh merged 1 commit intocharlie/typed-dict-1from
charlie/typed-dict-2
Mar 27, 2026
Merged

[ty] Support inheriting from functional TypedDict#24227
charliermarsh merged 1 commit intocharlie/typed-dict-1from
charlie/typed-dict-2

Conversation

@charliermarsh
Copy link
Copy Markdown
Member

Summary

This PR adds handling for class-based TypedDicts that inherit from functional TypedDicts.

Part of: astral-sh/ty#3095.

@astral-sh-bot astral-sh-bot bot added the ty Multi-file analysis & type inference label Mar 27, 2026
@charliermarsh
Copy link
Copy Markdown
Member Author

This is a revival of #24175 which was accidentally merged.

@charliermarsh charliermarsh marked this pull request as ready for review March 27, 2026 00:56
@astral-sh-bot
Copy link
Copy Markdown

astral-sh-bot bot commented Mar 27, 2026

Typing conformance results

No changes detected ✅

Current numbers
The percentage of diagnostics emitted that were expected errors held steady at 86.50%. The percentage of expected errors that received a diagnostic held steady at 81.37%. The number of fully passing files held steady at 67/132.

@astral-sh-bot
Copy link
Copy Markdown

astral-sh-bot bot commented Mar 27, 2026

Memory usage report

Memory usage unchanged ✅

@astral-sh-bot
Copy link
Copy Markdown

astral-sh-bot bot commented Mar 27, 2026

ecosystem-analyzer results

Lint rule Added Removed Changed
invalid-await 40 0 0
invalid-key 0 4 0
invalid-argument-type 0 2 0
invalid-return-type 1 0 0
Total 41 6 0

Changes in flaky projects detected. Raw diff output excludes flaky projects; see the HTML report for details.

Raw diff:

meson (https://github.com/mesonbuild/meson)
- mesonbuild/cargo/manifest.py:557:54 error[invalid-argument-type] Argument to bound method `from_raw` is incorrect: Expected `BuildTarget`, found `dict[str, str]`
- mesonbuild/cargo/manifest.py:557:73 error[invalid-key] Unknown key "path" for TypedDict `BuildTarget`
- mesonbuild/cargo/manifest.py:563:54 error[invalid-argument-type] Argument to bound method `from_raw` is incorrect: Expected `BuildTarget`, found `dict[str, str]`
- mesonbuild/cargo/manifest.py:563:73 error[invalid-key] Unknown key "path" for TypedDict `BuildTarget`

Full report with detailed diff (timing results)

@charliermarsh charliermarsh assigned AlexWaygood and unassigned sharkdp Mar 27, 2026
@carljm carljm removed their request for review March 27, 2026 03:11
@charliermarsh charliermarsh changed the base branch from charlie/typed-dict-1 to charlie/typed-dict-4 March 27, 2026 18:37
@charliermarsh charliermarsh changed the base branch from charlie/typed-dict-4 to charlie/typed-dict-1 March 27, 2026 19:49
@charliermarsh charliermarsh merged commit 9f5784a into charlie/typed-dict-1 Mar 27, 2026
29 checks passed
@charliermarsh charliermarsh deleted the charlie/typed-dict-2 branch March 27, 2026 20:48
charliermarsh added a commit that referenced this pull request Mar 30, 2026
## Summary

This PR adds basic support for functional TypedDict construction,
including recursive TypedDicts. The intent is to follow the patterns
we've established for functional NamedTuple and `type(...)` calls as
closely as we can.

There are two follow-up PRs that were carved out to make them easier to
review:

- #24226
- #24227

(My intent is to merge the stack once all three are approved. E.g., the
new false positive in the ecosystem test is fixed in
#24176.)

Part of: astral-sh/ty#3095.

---------

Co-authored-by: Alex Waygood <alex.waygood@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants