-
Notifications
You must be signed in to change notification settings - Fork 135
Open
Labels
bidirectional inferenceInference of types that takes into account the context of a declared type or expected typeInference of types that takes into account the context of a declared type or expected typediagnosticsRelated to reporting of diagnostics.Related to reporting of diagnostics.typeddict
Description
See astral-sh/ruff#21238 (comment). In cases where we may perform multi-inference, or don't have access to the RHS expression, we emit a diagnostic for TypedDict assignability as well as the existing invalid-key diagnostic.
class Person(TypedDict):
name: str
# error: [invalid-argument-type]
# error: [invalid-argument-type] "Invalid argument to key "name" with declared type `str` on TypedDict `Person`: value of type `None`"
accepts_person({"name": None})Ideally we could avoid the former.
Metadata
Metadata
Assignees
Labels
bidirectional inferenceInference of types that takes into account the context of a declared type or expected typeInference of types that takes into account the context of a declared type or expected typediagnosticsRelated to reporting of diagnostics.Related to reporting of diagnostics.typeddict