Skip to content

Commit 1d08db6

Browse files
committed
Readme tweak and router exercise tweak
1 parent 3d709d0 commit 1d08db6

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Exercises are in the [`./exercises`](./exercises) folder. They're designed to be
5959
Each exercise follows a similar pattern:
6060

6161
- Look at the file with the `*.code.ts` extension. This gives you the code we're going to be working through and trying to understand.
62-
- Read through the `*.exercise.ts` file. Read through the file, comment-by-comment, and follow the instructions by **editing the file inline**.
62+
- Read through the `*.exercise.ts` file. Read through the file, comment-by-comment, and follow the instructions by either editing the file inline, or editing the `*.code.ts` file.
6363
- Wherever you see reference to `Solution #1`, check the `*.solutions.ts` file when you want to see the solution. **Make sure you check the solution before proceeding!** There's often crucial information there.
6464

6565
Be careful to read through each part of the exercise carefully - if you skip over parts of them, it might get difficult to find your way back.

exercises/09-router.exercise.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ routes.goTo("/dashboard", {
7777
something: "",
7878
});
7979
/**
80-
* 🕵️‍♂️ Investigate routes.goTo above. See if you notice all
81-
* of the cool bits of this API.
80+
* 🕵️‍♂️ Investigate routes.goTo above. Discuss amongst yourselves to
81+
* see if you can spot all of the ways that routes.goTo is type-safe.
8282
*
8383
* Solution #1
8484
*/

exercises/09-router.solutions.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,25 @@
44
* 💡 First, you can't pass an invalid route to the
55
* first argument.
66
*
7+
* const routes = makeRouter({
8+
* "/": {},
9+
* });
10+
*
11+
* routes.goTo("/users");
12+
* ^ ⛔️
13+
*
714
* Second, you get autocomplete on the search parameters
815
* that you specify in the array in makeRoutes.
916
*
10-
* Third, you can't pass a search parameter if the route
11-
* in question doesn't have a search: [].
17+
* Third, you can't pass a second argument to routes.goTo at
18+
* all if you haven't specified a search param on that route.
19+
*
20+
* const routes = makeRouter({
21+
* "/": {},
22+
* });
23+
*
24+
* routes.goTo("/", {});
25+
* ^ ⛔️
1226
*
1327
* #2
1428
*

0 commit comments

Comments
 (0)