errors and warnings / types / E2013
E2013 error
Wrong number of type arguments
- area
- types (x2xxx)
- fails the build
- yes
- in plain Lua files
- reported as W2013
A generic type is given the wrong number of type arguments: Pair<A, B>
written as Pair<number>. Give one argument per type parameter. Writing a
generic type without any arguments is allowed (they are any), which the
optional lint W2063 can report.
Example
type Pair<A, B> = { first: A, second: B }local p: Pair<number> = { first = 1, second = 2 }print(p)type Pair<A, B> = { first: A, second: B }local p: Pair<number, number> = { first = 1, second = 2 }print(p)The compiler reports it like this:
error[E2013]: `Pair` takes 2 type arguments, but 1 were given ┌─ src/main.wowlua:2:10 │ 2 │ local p: Pair<number> = { first = 1, second = 2 } │ ^^^^^^^^^^^^ here
Related codes
Offline
$ wowlua explain E2013 E2013 (error): Wrong number of type arguments