C01

Error

Components

C01 — A required prop or field left out

A component's prop, or a record's field, that has no default is not given. The value would be undefined where the declaration promises one.

What the compiler said

error[C01]: `Todo(…)` leaves out `id` of `Todo`, which has no default --> src/App.wf:3:18 | 3 | state todo = Todo(title: "Write the docs") | ^^^^ = help: Give it, or declare a default in the type: `field: Type = value` = docs: https://webfluent.monzeromer.dev/errors/C01

The fix

Broken

wf

type Todo { id: String, title: String, done: Bool = false } page P(path: "/", title: "T", description: "D") { state todo = Todo(title: "Write the docs") Heading(todo.title).h1 }

Fixed

wf

type Todo { id: String, title: String, done: Bool = false } page P(path: "/", title: "T", description: "D") { state todo = Todo(id: "1", title: "Write the docs") Heading(todo.title).h1 }

Give it, or declare a default in the type (id: String = "") or on the prop.

A built-in that cannot be placed without a prop is held to it the same way: a Portal with no into: would draw nowhere, and the fix passes into: null for you to name the node.

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.