Back to Ruff

Invalid Assignment

crates/ty_python_semantic/resources/lint_docs/invalid-assignment.md

0.15.18402 B
Original Source

What it does

Checks for assignments where the type of the value is not assignable to the type of the assignee.

Why is this bad?

Such assignments break the rules of the type system and weaken a type checker's ability to accurately reason about your code.

Examples

python
a: int = ""  # error