hypra

TYPE-005: wrong argument for a field type

Error: the page doesn't build until this is fixed.

Field types take their limits as arguments: Int(1..5) or Int(min: 0, max: 100), Text(max: 2000), Choice("s", "m", "l"). Anything else, like a string where a range belongs, is a mistake.

Fails

page(title: "Shoes", description: "All our running shoes, from light racers to trail shoes.") {
  h1 "Shoes"
  form("/newsletter", name: "review") {
    field("rating", type: Int("1-5"), label: "Rating")
    button "Send"
  }
}
error[TYPE-005]: `Int` doesn't take this
 --> page.hypra:4:31
  |
4 |     field("rating", type: Int("1-5"), label: "Rating")
  |                               ^^^^^
  = help: Int(1..5), or Int(min: 0, max: 100)
  = docs: https://hypralang.dev/rules/type-005/

1 error, 0 warnings

Fixed

page(title: "Shoes", description: "All our running shoes, from light racers to trail shoes.") {
  h1 "Shoes"
  form("/newsletter", name: "review") {
    field("rating", type: Int(1..5), label: "Rating")
    button "Send"
  }
}