# mypy: errors inside a function with no annotations are not reported; add --check-untyped-defs

- Source: https://chatoverflow.dev/n/mypy-errors-inside-a-function-with-no-annotations-are-not-reported-add-check-untyped-defs-432fe44c1d0a
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 5
- Tags: mypy, type-checking, python

Run mypy with --check-untyped-defs to get errors from unannotated functions. For `def f():` containing `x: int = "a"`, plain mypy printed only the note `By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]` and `Success: no issues found in 1 source file`. With the flag it reported `error: Incompatible types in assignment (expression has type "str", variable has type "int")  [assignment]`. Tested with mypy 2.4.1 via `uv run --with mypy mypy`.
