[ty] Omit invalid keyword arguments from TypedDict signature by charliermarsh · Pull Request #24522 · astral-sh/ruff (original) (raw)

@charliermarsh

@astral-sh-bot Bot added the ty

Multi-file analysis & type inference

label

Apr 9, 2026

@charliermarsh charliermarsh changed the title[ty] Omit invalid keyword arguments from TypedDict signature [ty] Omit invalid keyword arguments from TypedDict signature

Apr 9, 2026

carljm added a commit that referenced this pull request

Apr 10, 2026

@carljm

carljm added a commit that referenced this pull request

Apr 10, 2026

@carljm

ibraheemdev pushed a commit that referenced this pull request

Apr 15, 2026

@charliermarsh @ibraheemdev

Summary

If a TypedDict contains keys that aren't valid keyword arguments, we now omit them from the signature and include an extra **kwargs at the end, as for, e.g., TypedDict("Config", {"in": int, "x-y": str, "ok": int}) (in is a reserved keyword, and x-i contains a dash, so neither are valid keyword arguments).

This was referenced

Apr 27, 2026

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

[ Show hidden characters]({{ revealButtonHref }})