docs: make `HeroService#gerHero()` in `toh-pt5` compatible with TS strict mode (#41234)
Fixes #41207 PR Close #41234
This commit is contained in:
parent
6d47b05b5b
commit
e23994191c
|
@ -19,7 +19,9 @@ export class HeroService {
|
|||
|
||||
// #docregion getHero
|
||||
getHero(id: number): Observable<Hero> {
|
||||
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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue