Skip to content

Commit 3a832f4

Browse files
authored
Fix three minor typos in part9c.md
1 parent 8298999 commit 3a832f4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/content/9/en/part9c.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1504,15 +1504,15 @@ const parseComment = (comment: unknown): string => {
15041504
};
15051505
```
15061506
1507-
are easy to replace as follws:
1507+
are easy to replace as follows:
15081508
15091509
```js
15101510
const parseComment = (comment: unknown): string => {
15111511
return z.string().parse(comment); // highlight-line
15121512
};
15131513
```
15141514
1515-
First the [string](https://zod.dev/?id=strings) method of Zod is used to define the required type (or <i>schema</i> in Zod terms). Adter that the value (which is of the type _unknown_) is parsed with the method [parse](https://zod.dev/?id=parse), which returns the value in the required type or throws an exception.
1515+
First the [string](https://zod.dev/?id=strings) method of Zod is used to define the required type (or <i>schema</i> in Zod terms). After that the value (which is of the type _unknown_) is parsed with the method [parse](https://zod.dev/?id=parse), which returns the value in the required type or throws an exception.
15161516
15171517
We do not actually need the helper function _parseComment_ anymore and can use the Zod parser directly:
15181518
@@ -1741,7 +1741,7 @@ Thanks to the middleware, the request body is now known to be of right type and
17411741
17421742
The syntax of the _Request<unknown, unknown, NewDiaryEntry>_ looks a bit odd. The _Request_ is a [generic type](https://www.typescriptlang.org/docs/handbook/2/generics.html#generic-types) with several type parameters. The third type parameter represents the request body, and in order to give it the value _NewDiaryEntry_ we have to give <i>some</i> value to the two first parameters. We decide to define those _undefined_ since we do not need those for now.
17431743
1744-
Since the possible errors in validation are now handed in the error handling middleware, we need to define one that handles the Zod errors properly:
1744+
Since the possible errors in validation are now handled in the error handling middleware, we need to define one that handles the Zod errors properly:
17451745
17461746
```js
17471747
const errorMiddleware = (error: unknown, _req: Request, res: Response, next: NextFunction) => {
@@ -1771,4 +1771,4 @@ The final version of the source code can be found in the part3 branch of [this](
17711771
17721772
Use Zod to validate the requests to the POST endpoint */api/patients*.
17731773
1774-
</div>
1774+
</div>

0 commit comments

Comments
 (0)