type constraint. When set, Errand validates the value at run time and converts it to the declared type automatically.
Primitive types
| Type | Description |
|---|---|
string | A UTF-8 string |
number | An integer or floating-point number |
bool | true or false |
Collection types
list
An ordered collection of values of the same type:set
An unordered collection with unique values:map
A collection of key-value pairs where all values share the same type:object
A collection of named attributes with potentially different types:tuple
An ordered list where each position has a fixed type:Optional attributes
Useoptional(type) or optional(type, default) within an object to mark fields as optional:
optional(type, default) use the given default when not provided. Fields declared with optional(type) default to null.
Omitting the type
Without atype, Errand accepts any value without validation:
type, it is always treated as a string.