errors and warnings / stdlib / E8340
E8340 error
Movable frame store field is not of type FramePosition?
- area
- stdlib (x8xxx)
- fails the build
- yes
frames.movable saves the frame's position in store[key], so that field
must have the type FramePosition? (from wowlua:frames): optional, because
it starts empty until the player first moves the frame. A field of another
type, a required field, or a key the store doesn't have is reported. Declare
the field as FramePosition?, usually in the defaults type of your
saved.bind store.
Example
import * as frames from "wowlua:frames" local db: { window: number? } = {}local window = CreateFrame("Frame", nil, UIParent)frames.movable(window, { store = db, key = "window" })import * as frames from "wowlua:frames"import type FramePosition from "wowlua:frames" local db: { window: FramePosition? } = {}local window = CreateFrame("Frame", nil, UIParent)frames.movable(window, { store = db, key = "window" })The compiler reports it like this:
error[E8340]: the store's `window` is `number?`; a movable frame keeps its position in a `FramePosition?` field ┌─ src/main.wowlua:5:44 │ 5 │ frames.movable(window, { store = db, key = "window" }) │ ^^^^^^^^ here
Offline
$ wowlua explain E8340 E8340 (error): Movable frame store field is not of type FramePosition?