Beginner
Typed routes
Write a type Route for a shop: the pages /, /cart and /checkout, and any product page /products/<something>. Then goTo(route: Route) that logs going to <route>.
Calling goTo("/chekout") (a typo) must be a type error. The program calls goTo("/cart") and goTo("/products/42").
What Check tests
- Your code has no type errors
- The program prints going to /products/42
- A typo in a page is rejected
- Any product page is accepted
- A made-up folder is rejected
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
Runs in your browser. Your code is saved here.
Press Run to see the page.
Console
Nothing printed yet.