errors and warnings / types / E2054
E2054 error
Conflicting field types in merged declare interface declarations
- area
- types (x2xxx)
- fails the build
- yes
- in plain Lua files
- reported as W2054
Two declare interface declarations of the same name (such as
AddonNamespace) merge into one interface, and they declare the same field
with conflicting types. Give the field one type in every declaration, or
rename one of them.
Example
declare interface AddonNamespace db: { scale: number }enddeclare interface AddonNamespace db: stringendlocal _, ns = ...print(ns.db)declare interface AddonNamespace db: { scale: number }enddeclare interface AddonNamespace version: stringendlocal _, ns = ...print(ns.db.scale, ns.version)The compiler reports it like this:
error[E2054]: the merged declarations of `AddonNamespace` give the field `db` two types: `{ scale: number }` and `string` ┌─ src/main.wowlua:5:5 │ 2 │ db: { scale: number } │ -- first declared here · 5 │ db: string │ ^^ declared again
Offline
$ wowlua explain E2054 E2054 (error): Conflicting field types in merged declare interface declarations