T34

Error

Types

T34 — A conversion the language does not make for you

A Date, a Time or a DateTime where a String is wanted: each has more than one spelling, and a splice says which — "{due}", "{due:.date(long)}". A Duration and a Number taken for each other: a duration says its unit — 500.ms, 3.seconds — and wait.ms() is the number it counts.

What the compiler said

error[T34]: `content:` on `Text` is `Date`, and a `Date` is not a `String`: it has more than one spelling --> src/App.wf:4:10 | 4 | Text(due) | ^^^ = help: Show it through a splice, which says how: `"{due}"`, or `"{due:.date(long)}"` = docs: https://webfluent.monzeromer.dev/errors/T34

Your editor offers this fix: Write "{due}". wf fix --code T34 applies it to every place it fits.

The fix

Broken

wf

page P(path: "/", title: "Due", description: "D") { state due: Date = @2026-03-14 Heading("Due").h1 Text(due) }

Fixed

wf

page P(path: "/", title: "Due", description: "D") { state due: Date = @2026-03-14 Heading("Due").h1 Text("{due:.date(long)}") }

A splice for a date or a time — "{due}", "{due:.date(long)}"; a unit for a number — 500.ms, 2.seconds; .ms() for the number a duration counts.

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.

A Date, a Time and a DateTime are carried by strings, but each has more than one spelling — 2026-03-14, March 14, 2026, 14/03/2026 — so the language does not pick one where a String is wanted. A splice shows the value and says how: "{due}" is its ISO text, "{due:.date(long)}" the reader's own.

A Duration is a number of milliseconds, but 3.seconds + 500 does not say what the 500 is. A duration adds to a duration and is scaled by a number (wait * 2); wait.ms() is the number it counts.

An address, a colour and an id (Url, Email, Color, Uuid) have one spelling, and are strings wherever text is wanted.

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