hypra

TYPE-001: prop missing from the data

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

The page declares a prop that the data doesn't have, so everything that shows it would be empty. It's found when the page is built or rendered with its data; often the server passes it under another name.

Fails

{
  "shoe": { "name": "Runner X" }
}
page(title: "Shoes", description: "All our running shoes, from light racers to trail shoes.") {
  props(product: Product)
  h1 "Shoes"
  p "{product.name}"
}
error[TYPE-001]: prop `product` is missing from the data
 --> page.hypra:2:9
  |
2 |   props(product: Product)
  |         ^^^^^^^
  = help: pass it with --data file.json
  = docs: https://hypralang.dev/rules/type-001/

1 error, 0 warnings

Fixed

page(title: "Shoes", description: "All our running shoes, from light racers to trail shoes.") {
  props(shoe: Shoe)
  h1 "Shoes"
  p "{shoe.name}"
}