From e23994191cf0f662c864ff7d6e65482e6889f324 Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Tue, 16 Mar 2021 23:31:19 +0200 Subject: [PATCH] docs: make `HeroService#gerHero()` in `toh-pt5` compatible with TS strict mode (#41234) Fixes #41207 PR Close #41234 --- aio/content/examples/toh-pt5/src/app/hero.service.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/aio/content/examples/toh-pt5/src/app/hero.service.ts b/aio/content/examples/toh-pt5/src/app/hero.service.ts index 0d7845681b..4cdf959945 100644 --- a/aio/content/examples/toh-pt5/src/app/hero.service.ts +++ b/aio/content/examples/toh-pt5/src/app/hero.service.ts @@ -19,7 +19,9 @@ export class HeroService { // #docregion getHero getHero(id: number): Observable { - const hero = HEROES.find(h => h.id === id); + // For now, assume that a hero with the specified `id` always exists. + // Error handling will be added in the next step of the tutorial. + const hero = HEROES.find(h => h.id === id) as Hero; this.messageService.add(`HeroService: fetched hero id=${id}`); return of(hero); }