hypra

COMP-003: unknown component argument

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

The component has no parameter by that name, so the value would go nowhere. The message lists the parameters it has.

Fails

component ReviewCard(author: Text, text: Text) {
  figure {
    blockquote "{text}"
    figcaption "{author}"
  }
}

page(title: "Shoes", description: "All our running shoes, from light racers to trail shoes.") {
  h1 "Shoes"
  ReviewCard(author: "Ana", text: "Light and fast.", stars: 5)
}
error[COMP-003]: `ReviewCard` has no parameter `stars`
  --> page.hypra:10:54
   |
10 |   ReviewCard(author: "Ana", text: "Light and fast.", stars: 5)
   |                                                      ^^^^^
   = help: parameters: author, text
   = docs: https://hypralang.dev/rules/comp-003/

1 error, 0 warnings

Fixed

component ReviewCard(author: Text, text: Text, stars: Int = 5) {
  figure {
    blockquote "{text}"
    figcaption "{author}, {stars} stars"
  }
}

page(title: "Shoes", description: "All our running shoes, from light racers to trail shoes.") {
  h1 "Shoes"
  ReviewCard(author: "Ana", text: "Light and fast.", stars: 5)
}

Or add the parameter to the component, as above.