Skip to content
ZOLO / TE201 Type · error

`@strict`: variable must have a type annotation

Strict typing requires every `let`/`const` to have an explicit type annotation.

Why this fires

Zolo's type checker has a Strict strictness mode that requires every let binding to resolve to a concrete type — either through an explicit annotation, or by inferring something more specific than any/unknown from its value. A binding whose value's type can't be pinned down (e.g. it comes from a function whose return type is any) is rejected instead of silently degrading to any.

fn get_value() -> any { return 42 }

let x = get_value()
// error[TE201]: strict mode: variable 'x' must have a type annotation

Current status: zolo.toml's [compiler] type_check = "strict" field documents the intent, but as of this writing no CLI command (zolo check, zolo build, zolo run) or the LSP actually switches the type checker into Strict mode — they all run in Relaxed/Standard mode regardless of that setting. TE201 is reachable today only through the compiler's own Rust API (zolo_compiler::compiler::type_check_with_mode(src, StrictnessMode::Strict) / compile_to_lua_with_mode), which is how the compiler's own test suite exercises it. If you hit this code from tooling, you are using that API directly (e.g. embedding the compiler, or a custom build script).

Fix it

1. Add an explicit annotation

let x: int = get_value()        // ok — annotation pins the type down

2. Give the source function a concrete return type

fn get_value() -> int { return 42 }

let x = get_value()             // ok — inferred as int

See also

  • TE202 — the same rule for function parameters.

Global index

Find your way through Zolo

Try an idea

Start here

9 results

9 results

enespt-br