errors and warnings / types / E2060
E2060 error
A local after an annotated one is named after a type (local a, b: T, U: the annotations go on each name, local a: T, b: U)
- area
- types (x2xxx)
- fails the build
- yes
- in plain Lua files
- reported as W2060
In local a, b: T, U, the annotation belongs to b only, so U is read as
a third local named after a type. Annotate each name on its own:
local a: T, b: U.
Example
local x, y: number, number = 1, 2print(x, y)local x: number, y: number = 1, 2print(x, y)The compiler reports it like this:
error[E2060]: `number` is declared as a local, but it names a type: annotate each name (`local a: T, b: U`) ┌─ src/main.wowlua:1:21 │ 1 │ local x, y: number, number = 1, 2 │ ^^^^^^ here
Related codes
| code | message |
|---|---|
| E2001 | Type mismatch: S is not assignable to T |
Offline
$ wowlua explain E2060 E2060 (error): A local after an annotated one is named after a type (local a, b: T, U: the annotations go on each name, local a: T, b: U)