E0340 Wrong type
Words in italics are filled in when the compiler reports it, such as the element's name or the list of known ones.
Why
A value has a type the place it is used does not accept: a number passed to a string prop, a string where an attribute takes true or false, a word an attribute does not know (type="emial"), a handler that expects something other than what its event gives, or a binding whose state and field disagree. When the page ran it would show the wrong thing, or fail. duolith check, duolith build and duolith dev run TypeScript over the script block and every typed position in the markup (docs/explanation/types.md); the editor shows the same error.
How to fix it
Change the value to the type the place takes, or change the type it is declared with. For a binding, give the state the field's type, such as state<number>(0) for a slider.
In a terminal
duolith explain E0340
Mentioned in
- Features and where to see them
- Data: loading, writing and streaming
- Types
- 0096. duolith check runs the real TypeScript checker, and every build and dev server runs it
- 0097. Pages are checked with the strictest practical TypeScript options
- 0098. A <match> element for unions, and a resource's states as a union
- 0104. A typed API client from an OpenAPI description
- 0145. An installed Duolith carries its Node companions, and the templates carry tests
- Example: typed-errors