T20

Error

Types

T20 — A list or a record shown as text

A list in text runs its items together with commas, and a map or a record shows as [object Object]. Show a field, or join a list of text.

What the compiler said

error[T20]: `tags` is `[String]`, and in text it shows as its items run together with commas --> src/App.wf:4:19 | 4 | Text("Tagged {tags}") | ^^^^ = help: Show a field of it, or `.join(", ")` a list of text = docs: https://webfluent.monzeromer.dev/errors/T20

The fix

Broken

wf

page P(path: "/", title: "T", description: "D") { state tags = ["a", "b"] Heading("Tags").h1 Text("Tagged {tags}") }

Fixed

wf

page P(path: "/", title: "T", description: "D") { state tags = ["a", "b"] Heading("Tags").h1 Text("Tagged {tags.join(", ")}") }

{tags.join(", ")} for a list of text; a field of a record.

Each example is a whole program: it is all of src/App.wf in a project with no other .wf file (trying an example).

Why this rule exists

Error.

lints cannot lower it: it would ship a broken page.