hypra

TYPE-003: value isn't a list

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

for goes through a list, and the data has something else there, like a string. It's found when the page is built or rendered with its data.

Fails

{
  "shoe": { "sizes": "38-47" }
}
page(title: "Shoes", description: "All our running shoes, from light racers to trail shoes.") {
  props(shoe: Shoe)
  h1 "Shoes"
  ul { for size in shoe.sizes { li "{size}" } }
}
error[TYPE-003]: `shoe.sizes` isn't a list
 --> page.hypra:4:20
  |
4 |   ul { for size in shoe.sizes { li "{size}" } }
  |                    ^^^^^^^^^^
  = docs: https://hypralang.dev/rules/type-003/

1 error, 0 warnings

Fixed

{
  "shoe": { "sizes": [38, 39, 40] }
}
page(title: "Shoes", description: "All our running shoes, from light racers to trail shoes.") {
  props(shoe: Shoe)
  h1 "Shoes"
  ul { for size in shoe.sizes { li "{size}" } }
}