v0.13.7
errors and warnings / types

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

× failswowlua
declare interface AddonNamespace    db: { scale: number }enddeclare interface AddonNamespace    db: stringendlocal _, ns = ...print(ns.db)
✓ compileswowlua
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

terminal
$ wowlua explain E2054
E2054 (error): Conflicting field types in merged declare interface declarations

source on GitHub ↗