Skip to content

Commit 44f5ae2

Browse files
authored
Update part9c.md
The original code gives an error because you set the return type to be "DiaryEntry[]" but the res actually returns values from "getNonSensitiveEntries()" which has a "NonSensitiveDiaryEntry" type(without the "comment" property"). It gave an error - 'comment' is declared here. The fix is to set the "NonSensitiveDiaryEntry[]" type instead of "DiaryEntry[]" type.
1 parent bd51f89 commit 44f5ae2

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/content/9/en/part9c.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -839,10 +839,10 @@ We could and propably should give a proper type as the type variable. In our cas
839839
840840
```js
841841
import { Response } from 'express'
842-
842+
import { NonSensitiveDiaryEntry } from "../types";
843843
// ...
844844

845-
router.get('/', (_req, res: Response<DiaryEntry[]>) => {
845+
router.get('/', (_req, res: Response<NonSensitiveDiaryEntry[]>) => {
846846
res.send(diaryService.getNonSensitiveEntries());
847847
});
848848

0 commit comments

Comments
 (0)