T30
Error
Types
T30 — A part of the browser the language does not type
The browser's globals and the objects it hands a program — an element, an event, localStorage, the clipboard — are typed by the language's browser table, so a misspelt member is found where it is written. A global or a member the table does not list is reached from a project script whose JSDoc says its types: the call is then checked like any other.
What the compiler said
error[T30]: the language does not type `navigator.clipbaord` --> src/App.wf:6:23 | 6 | navigator.clipbaord.writeText(location.href) | ^^^^^^^^^ = help: Did you mean `clipboard`? Reach it from a script under src/ and say its types in JSDoc; the call is then checked like any other = docs: https://webfluent.monzeromer.dev/errors/T30
Your editor offers this fix: Change to clipboard. wf fix --code T30 applies it to every place it fits.
The fix
Broken
page P(path: "/", title: "T", description: "D") {
state copied = false
Heading("Share").h1
Button("Copy the link") {
on click {
navigator.clipbaord.writeText(location.href)
copied = true
}
}
if copied { Text("Copied") }
}
Fixed
page P(path: "/", title: "T", description: "D") {
state copied = false
Heading("Share").h1
Button("Copy the link") {
on click {
navigator.clipboard.writeText(location.href)
copied = true
}
}
if copied { Text("Copied") }
}
When it is a slip, the help names the member meant, and the
editor's quick fix writes it. When it is a part of the browser the table
does not cover — navigator.bluetooth, crypto.subtle — reach it from a
plain script under src/, with JSDoc for what it takes and returns; the
call from the page is then checked like any other (see Your own
JavaScript).
// src/share.js
/**
* Ask the system to share a link.
* @param {string} url
* @returns {Promise<void>}
*/
async function share(url) {
await navigator.share({ url });
}
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.
The browser's names keep the meaning the browser gives them, and the
language types them: window, document, localStorage, JSON, Math,
navigator, location, the timers, the element a ref: names, and the
event a handler is given — on keydown(e) is a KeyboardEvent, so
e.key is a String and e.kye is found where it is written. The table
covers what pages reach for. Anything it does not list is T30, whether it
is misspelt or simply a part of the browser the language leaves out.
lints cannot lower it: it would ship a broken page.