T14
Error
Types
T14 — A comparison that is always the same
== or != between values that can never be equal — a string and a number, a record and a string, an enum and a case it does not have — so the answer never changes.
What the compiler said
error[T14]: `count` is `Number` and `"0"` is `String`, which are never equal, so this is always false --> src/App.wf:4:8 | 4 | if count == "0" { Text("Nothing yet") } | ^^^^^ = help: Convert one side: `Number(text) == n`, or `"{n}" == text` = docs: https://webfluent.monzeromer.dev/errors/T14
The fix
Broken
page P(path: "/", title: "T", description: "D") {
state count = 0
Heading("Count").h1
if count == "0" { Text("Nothing yet") }
}
Fixed
page P(path: "/", title: "T", description: "D") {
state count = 0
Heading("Count").h1
if count == 0 { Text("Nothing yet") }
}
Compare values of one type: count == 0, or convert one side
(Number(text) == n). Against an enum, use a case it has.
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.