Skip to content

Conversation

@asukaminato0721
Copy link
Contributor

fix #1189

Introduced dict key completions: added facet chains and literal facet propagation.

@meta-cla meta-cla bot added the cla signed label Nov 6, 2025
@asukaminato0721 asukaminato0721 marked this pull request as ready for review November 6, 2025 14:26
@asukaminato0721 asukaminato0721 marked this pull request as draft November 8, 2025 08:01
@asukaminato0721 asukaminato0721 marked this pull request as ready for review November 8, 2025 10:24
@meta-codesync
Copy link

meta-codesync bot commented Nov 10, 2025

@kinto0 has imported this pull request. If you are a Meta employee, you can view this in D86695925.

items: int
td: TD = {'items': 1}
assert_type(td['items'], int)
assert_type(td['items'], Literal[1])
Copy link
Contributor

Choose a reason for hiding this comment

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

could this mean it's harder to add items to a typeddict (i.e. all additions must be literal[1] and not int?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

47485e9

so td['items'] = 2 will fail but td['items'] = a int value will pass now. A bit too strict.

Copy link
Contributor

Choose a reason for hiding this comment

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

@asukaminato0721 could we factor just the facet narrows out into a separate PR?

There's a lot of lsp logic in this change, but the typing implications are - I think - entirely due to the new facet narrows and we could focus on those separately

@kinto0 kinto0 self-assigned this Nov 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

auto complete dict key when possible

3 participants