You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
1516
1516
1517
1517
We do not actually need the helper function _parseComment_ anymore and can use the Zod parser directly:
1518
1518
@@ -1741,7 +1741,7 @@ Thanks to the middleware, the request body is now known to be of right type and
1741
1741
1742
1742
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.
1743
1743
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:
0 commit comments