Skip to content

Commit d043882

Browse files
authored
Update part9c.md
You defined them as type unknown but stated undefined.
1 parent fc23240 commit d043882

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/content/9/en/part9c.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1745,7 +1745,7 @@ router.post('/', newDiaryParser, (req: Request<unknown, unknown, NewDiaryEntry>,
17451745
17461746
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_.
17471747
1748-
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.
1748+
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.
17491749
17501750
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:
17511751

0 commit comments

Comments
 (0)