Skip to content

typeddict: disallow nesting Required in itself - #2374

Merged
JelleZijlstra merged 1 commit into
python:mainfrom
JelleZijlstra:double-required
Oct 20, 2026
Merged

JelleZijlstra merged 1 commit into
python:mainfrom
JelleZijlstra:double-required

Conversation

@JelleZijlstra

Copy link
Copy Markdown
Member

Fixes #2372

@jorenham jorenham left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see the harm in stacking these, but neither is there a use-case for this, so removing the self-nesting conformance check would also be fine as far as I'm concerned. Either way, this improves consistency, so it's a ++1 from me ;)

@carljm carljm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as @jorenham, I'd also be fine with not caring about this, but this is fine too.

@JelleZijlstra

Copy link
Copy Markdown
Member Author

Not caring about it is also fine with me, but it seems like more work since current type checkers do emit an error.

@JelleZijlstra
JelleZijlstra merged commit af86235 into python:main Oct 20, 2026
5 checks passed
@JelleZijlstra
JelleZijlstra deleted the double-required branch October 20, 2026 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error for Required[Required[int]]

4 participants