Skip to content

Commit 410c3f2

Browse files
committed
fix typos in material
1 parent 8298999 commit 410c3f2

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
@@ -1512,7 +1512,7 @@ const parseComment = (comment: unknown): string => {
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
@@ -1644,7 +1644,7 @@ export interface DiaryEntry {
16441644
export type NewDiaryEntry = Omit<DiaryEntry, 'id'>;
16451645
```
16461646
1647-
So besides the type _NewDiaryEntry_ we have also the Zod schema _NewEntrySchema_ that defines the shape of a new entry. We can use the shema to [infer](https://zod.dev/?id=type-inference) the type:
1647+
So besides the type _NewDiaryEntry_ we have also the Zod schema _NewEntrySchema_ that defines the shape of a new entry. We can use the schema to [infer](https://zod.dev/?id=type-inference) the type:
16481648
16491649
```js
16501650
import { z } from 'zod';
@@ -1674,7 +1674,7 @@ export interface DiaryEntry extends NewDiaryEntry {
16741674
16751675
This would remove all the duplication in the type and schema definitions but feels a bit backward so we decide to define the type _DiaryEntry_ explicitly with TypeScript.
16761676
1677-
Unfortunately the oppisite is not possible: we can not define the Zod schema based on TypeScript type definitions, and due to this, the duplication in the type and schema definitions is hard to avoid.
1677+
Unfortunately the opposite is not possible: we can not define the Zod schema based on TypeScript type definitions, and due to this, the duplication in the type and schema definitions is hard to avoid.
16781678
16791679
The current state of the source code can be found in the part2 branch of [this](https://github.com/fullstack-hy2020/flight-diary/tree/part2) GitHub repository.
16801680
@@ -1726,7 +1726,7 @@ const newDiaryParser = (req: Request, _res: Response, next: NextFunction) => {
17261726
};
17271727
```
17281728
1729-
The middleware just calls the shema parser to the request body. If the parsing thwrows an exception, that is passed to the error handling middleware.
1729+
The middleware just calls the schema parser to the request body. If the parsing throws an exception, that is passed to the error handling middleware.
17301730
17311731
So after the request passes this middleware, it <i>is known that the request body is a proper new diary entry</i>. We can tell this fact to TypeScript compiler by giving a type parameter to the _Request_ type:
17321732

0 commit comments

Comments
 (0)