v0.13.7
errors and warnings / types

errors and warnings / types / E2050

E2050 error

Missing parameter type annotation (strict mode)

area
types (x2xxx)
fails the build
yes
in plain Lua files
reported as W2050

Strict mode: a parameter has no type annotation. Annotate it. Callbacks are exempt: a function written directly as a call argument, or where a type is expected, takes its parameter types from there.

Example

× failswowlua
--!strictlocal function double(n)    return n * 2endprint(double(2))
✓ compileswowlua
--!strictlocal function double(n: number): number    return n * 2endprint(double(2))

The compiler reports it like this:

error[E2050]: parameter `n` needs a type annotation
  ┌─ src/main.wowlua:2:23
  │
2 │ local function double(n)
  │                       ^ here
codemessage
W2063A parameter without an annotation that nothing gives a type (no expected function type, or one that says any), or a local without an annotation whose value is any, or a generic type written without its type arguments (Box for Box<T>: they are any; decision T276), or a member a widget class doesn't declare, read or set through the openness of the game's frames (decision L51): it is any without saying so. Off unless check.lints sets it ("W2063": "warn"); names starting with _ are exempt (decision T274)

Offline

terminal
$ wowlua explain E2050
E2050 (error): Missing parameter type annotation (strict mode)

source on GitHub ↗