Skip to content

Commit

Permalink
Merge pull request #3904 from leburgeon/patch-7
Browse files Browse the repository at this point in the history
Update part9c.md
  • Loading branch information
mluukkai authored Dec 7, 2024
2 parents 19ad401 + d043882 commit d170e86
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/content/9/en/part9c.md
Original file line number Diff line number Diff line change
Expand Up @@ -1745,7 +1745,7 @@ router.post('/', newDiaryParser, (req: Request<unknown, unknown, NewDiaryEntry>,
Thanks to the middleware, the request body is now known to be of right type and it can be directly given as parameter to the function _diaryService.addDiary_.
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.
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 _unknown_ since we do not need those for now.
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:
Expand Down

0 comments on commit d170e86

Please sign in to comment.