T09
Error
Types
T09 — An emit that does not match its event
The arguments an emit passes are not the ones the event declares.
What the compiler said
error[T09]: `emit change` passes 2 arguments, but the event takes 1 --> src/App.wf:3:30 | 3 | Button("+") { on click { emit change(1, 2) } } | ^^^^^^^^^^^^^^^^^ = help: `event change(value: Number)` = docs: https://webfluent.monzeromer.dev/errors/T09
The fix
Broken
component Counter(_ start: Number) {
event change(value: Number)
Button("+") { on click { emit change(1, 2) } }
}
Fixed
component Counter(_ start: Number) {
event change(value: Number)
Button("+") { on click { emit change(start + 1) } }
}
page P(path: "/", title: "T", description: "D") {
state n = 0
Heading("Count {n}").h1
Counter(n) { on change(v) { n = v } }
}
Pass what the event declares, in order, or change the declaration.
Each example is a whole program: it is all of src/App.wf in a project with no other .wf file (trying an example).
lints cannot lower it: it would ship a broken page.