annotations_typeexpr error

Invalid type form — numeric literal used as type annotation

Type annotations must be type expressions, not literal values. Using a number such as 42, 3.14, or True as a type annotation is always a mistake (it is valid Python syntax but meaningless as a type).

def f(x: 42) -> 0:   # both parameter and return annotation are literals
    ...

How to handle it

Every rule is on by default — strict is the default, not a cage. You can dial annotations_typeexpr down per-file or per-path from your editor or pyproject.toml, or fix the code so it type-checks. See the Type System rules and the complete diagnostic reference.

Canonical URL: https://www.basilisk-python.dev/errors/annotations_typeexpr